From: minima Date: Tue, 5 Dec 2000 14:30:37 +0000 (+0000) Subject: fix sh/dx properly both for freq range and adding a . to the end of X-Git-Tag: R_1_45~6 X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1a882ec013f6758062bd4fc2d9a612ca7a2160d0;p=spider.git fix sh/dx properly both for freq range and adding a . to the end of a freq so it doesn't match any times. --- diff --git a/cmd/show/dx.pl b/cmd/show/dx.pl index 380328ee..c63e063f 100644 --- a/cmd/show/dx.pl +++ b/cmd/show/dx.pl @@ -101,7 +101,7 @@ if (@freq) { for ($i = 0; $i < @freq; $i += 2) { $expr .= "(\$f0 >= $freq[$i] && \$f0 <= $freq[$i+1]) ||"; my $r = Spot::ftor($freq[$i], $freq[$i+1]); - $hint .= "m{$r} ||" if $r; + $hint .= "m{$r\\.} ||" if $r; } chop $expr; chop $expr; chop $hint; chop $hint; diff --git a/perl/Spot.pm b/perl/Spot.pm index cb91c18a..57cf2599 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -230,6 +230,7 @@ sub ftor my ($a, $b) = @_; return undef unless $a < $b; $b--; + my $d = $b - $a; my @a = split //, $a; my @b = split //, $b; my $out; @@ -239,7 +240,9 @@ sub ftor while (@b) { my $aa = shift @a; my $bb = shift @b; - if ($aa eq $bb) { + if (@b < (length $d) - 1) { + $out .= '\\d'; + } elsif ($aa eq $bb) { $out .= $aa; } elsif ($aa < $bb) { $out .= "[$aa-$bb]";