fixed help \
authorminima <minima>
Sun, 5 Nov 2000 20:53:27 +0000 (20:53 +0000)
committerminima <minima>
Sun, 5 Nov 2000 20:53:27 +0000 (20:53 +0000)
Changes
cmd/help.pl
perl/DXLogPrint.pm

diff --git a/Changes b/Changes
index 2d541199d1079645cf397f46b1c206a505d33972..a4e04db723a07bb5b71d36e7a7ecf30cbe3d17b7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,7 +1,9 @@
 05Nov00=======================================================================
 1. 75% speed up on sh/dx !, lower memory usage as well!
 2. Fixed problem with clear/spot 0 (how did this one last so long!!!)
-3. add 'on' in accept/reject spots as synonym for 'freq' 
+3. add 'on' in accept/reject spots as synonym for 'freq'
+4. add the same speed up to general log printing
+5. fixed help \ 
 04Nov00=======================================================================
 1. fix sh/filter so ity now works for any callsign (and not just connected
 ones).
index d87de98113d6fc84829dd08619cedbd592dc307e..011519f626924268925dd17082852dedb56dc445 100644 (file)
@@ -14,7 +14,6 @@ my ($self, $line) = @_;
 my @out;
 
 # this is naff but it will work for now
-$line = "help" unless $line;
 my $lang = $self->lang;
 $lang = 'en' if !$lang;
 
@@ -41,10 +40,11 @@ if (!open($h, "$main::localcmd/Commands_$lang.hlp")) {
 }
 my $in;
 
-$line =~ s/![\w\/]//og;
-$line =~ s/\//\.\*\//og;
-$line =~ s/^\s+//og;
-$line =~ s/\s+$//og;
+$line =~ s/[^\w\/]//g;
+$line =~ s/\//\.\*\//g;
+$line =~ s/^\s+//g;
+$line =~ s/\s+$//g;
+$line = "help" if $line =~ /^\s*$/;
 
 # sort out aliases
 my $alias = CmdAlias::get_hlp($line);
index 185912cda4948abefe7d3408da3d371651921417..58f18ffdd7604eae03239eb7fb48cbecbb793270 100644 (file)
@@ -35,14 +35,34 @@ sub print
        my @out = ();
        my $eval;
        my $count;
+       my $hint = "";
            
        $search = '1' unless $pattern || $who;
-       $search = "\$ref->[1] =~ /$pattern/i" if $pattern;
-       $search .= ' && ' if $pattern && $who;
-       $search .= "(\$ref->[2] =~ /$who/i || \$ref->[3] =~ /$who/i)" if $who;
+       if ($pattern) {
+               $search = "\$ref->[1] =~ m{$pattern}i";
+               $hint = "m{$pattern}i";
+       }
+
+       if ($who) {
+               if ($search) {
+                       $search .= ' && ';
+                       $hint .= ' && ';
+               }
+               $search .= "(\$ref->[2] =~ m{$who}i || \$ref->[3] =~ m{$who}i)";
+               $hint .= 'm{$who}i';
+       }
+       $hint = "next unless $hint" if $hint;
+       
        $eval = qq(
+                          \@in = ();
+                          while (<\$fh>) {
+                                  $hint;
+                                  chomp;
+                                  \$ref = [ split '\\^' ];
+                                  push \@\$ref, "" unless \@\$ref >= 4;
+                                  push \@in, \$ref;
+                          }
                           my \$c;
-                          my \$ref;
                           for (\$c = \$#in; \$c >= 0; \$c--) {
                                        \$ref = \$in[\$c];
                                        if ($search) {
@@ -60,13 +80,6 @@ sub print
        for ($count = 0; $count < $to; ) {
                my $ref;
                if ($fh) {
-                       @in = ();
-                       while (<$fh>) {
-                               chomp;
-                               $ref = [ split '\^' ];
-                               push @{$ref}, "" unless @{$ref} >= 4;
-                               push @in, $ref;
-                       }
                        eval $eval;               # do the search on this file
                        last if $count >= $to;                  # stop after n
                        return ("Log search error", $@) if $@;