improve sh/log sh/rcmd etc
authorminima <minima>
Mon, 28 Oct 2002 23:15:16 +0000 (23:15 +0000)
committerminima <minima>
Mon, 28 Oct 2002 23:15:16 +0000 (23:15 +0000)
fix correct msg for dupes in dx command

Changes
cmd/dx.pl
perl/DXLogPrint.pm
perl/cluster.pl

diff --git a/Changes b/Changes
index 59ec29c83637d18b185ccd927efd66737d0733e4..2e686ce132a59d762bfc12b954e4feaea809468c 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+29Oct02=======================================================================
+1. make sh/log et al a bit more efficient.
+2. fix dupe message in dx.
 25Oct02=======================================================================
 1. remove the dupefile automatically if it becomes corrupted
 2. instrument the startup slightly more
index 46d427e0fb57333c5fe78a2425394429df65ac7c..eefbb8603380ad7e7c8978e64290598d6d290f02 100644 (file)
--- a/cmd/dx.pl
+++ b/cmd/dx.pl
@@ -103,7 +103,7 @@ return (1, @out) unless $valid;
 
 # Store it here (but only if it isn't baddx)
 my $t = (int ($main::systime/60)) * 60;
-return (1, $self->msg('dupspot')) if Spot::dup($freq, $spotted, $t, $line, $spotter);
+return (1, $self->msg('dup')) if Spot::dup($freq, $spotted, $t, $line, $spotter);
 my @spot = Spot::prepare($freq, $spotted, $t, $line, $spotter, $main::mycall);
 
 if ($DXProt::baddx->in($spotted) || $freq =~ /^69/ || $localonly) {
index 6012d71d065cfa2bec14488d648c1bb68b9a8064..a01f5dedca68f663d55f07dc69465aff42746c77 100644 (file)
@@ -33,7 +33,6 @@ sub print
        my $fcb = $DXLog::log;
        my $from = shift || 0;
        my $to = shift || 20;
-       my $count;
        my $jdate = $fcb->unixtoj(shift);
        my $pattern = shift;
        my $who = uc shift;
@@ -50,45 +49,42 @@ sub print
                $hint = "!m{ann|rcmd|talk}";
        }
        if ($who) {
-               if ($hint) {
-                       $hint .= ' && ';
-               }
+               $hint .= ' && ' if $hint;
                $hint .= 'm{\\Q$who\\E}i';
        } 
        $hint = "next unless $hint" if $hint;
+       $hint .= ";next unless /^\\d+\\^$pattern\\^/" if $pattern;
+       $hint ||= "";
        
-       $eval = qq(
-                          \@in = ();
-                          while (<\$fh>) {
+       $eval = qq(while (<\$fh>) {
                                   $hint;
                                   chomp;
-                                  push \@in, \$_;
-                                  shift \@in, if \@in > $tot;
-                          }
-                  );
+                                  push \@tmp, \$_;
+                          } );
        
        $fcb->close;                                      # close any open files
 
        my $fh = $fcb->open($jdate); 
      L1: for ($count = 0; $count < $to; ) {
L1: for (;@in < $to;) {
                my $ref;
                if ($fh) {
+                       my @tmp;
                        eval $eval;               # do the search on this file
                        return ("Log search error", $@) if $@;
-                       my @tmp;
-                       while (@in) {
-                               last L1 if $count >= $to;
-                               my $ref = [ split /\^/, shift @in ];
-                               next if defined $pattern && $ref->[1] ne $pattern;
-                               push @tmp, print_item($ref);
-                               $count++;
-                       }
-                       @out = (@tmp, @out);
+                       @in = (@tmp, @in);
+                       if (@in > $to) {
+                               @in = splice @in, -$to, $to;
+                               last L1;
+                       } 
                }
                $fh = $fcb->openprev();      # get the next file
                last if !$fh;
        }
+       for (@in) {
+               my @line = split /\^/ ;
+               push @out, print_item(\@line);
        
+       }
        return @out;
 }
 
@@ -105,22 +101,26 @@ sub print
 sub print_item
 {
        my $r = shift;
-       my @ref = @$r;
-       my $d = atime($ref[0]);
+       my $d = atime($r->[0]);
        my $s = 'undef';
        
-       if ($ref[1] eq 'rcmd') {
-               if ($ref[2] eq 'in') {
-                       $s = "$ref[4] (priv: $ref[3]) rcmd: $ref[5]";
+       if ($r->[1] eq 'rcmd') {
+               if ($r->[2] eq 'in') {
+                       $r->[5] ||= "";
+                       $s = "$r->[4] (priv: $r->[3]) rcmd: $r->[5]";
                } else {
-                       $s = "$ref[3] reply: $ref[4]";
+                       $r->[4] ||= "";
+                       $s = "$r->[3] reply: $r->[4]";
                }
-       } elsif ($ref[1] eq 'talk') {
-               $s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
-       } elsif ($ref[1] eq 'ann') {
-               $s = "$ref[3] -> $ref[2] $ref[4]";
+       } elsif ($r->[1] eq 'talk') {
+               $r->[5] ||= "";
+               $s = "$r->[3] -> $r->[2] ($r->[4]) $r->[5]";
+       } elsif ($r->[1] eq 'ann') {
+               $r->[4] ||= "";
+               $s = "$r->[3] -> $r->[2] $r->[4]";
        } else {
-               $s = "$ref[2]";
+               $r->[2] ||= "";
+               $s = "$r->[2]";
        }
        return "$d $s";
 }
index d6e323276696098ed4e2928cfb110facd4c2dd63..0b4e7428fcee2c421d12b348962373e7ba506900 100755 (executable)
@@ -395,7 +395,8 @@ dbg("DXSpider Version $version, build $build started");
 
 # load Prefixes
 dbg("loading prefixes ...");
-Prefix::load();
+my $r = Prefix::load();
+confess $r if $r;
 dbg(USDB::init());
 
 # load band data