change watchdbg and grepdbg to show preceeding lines
authorminima <minima>
Sun, 3 Dec 2000 13:48:26 +0000 (13:48 +0000)
committerminima <minima>
Sun, 3 Dec 2000 13:48:26 +0000 (13:48 +0000)
remove sh/call from help

Changes
cmd/Commands_en.hlp
perl/cluster.pl
perl/grepdbg
perl/watchdbg

diff --git a/Changes b/Changes
index 4bf36d1e842611d4ddd5baad6ea06626a9b4a401..1745e0f079c594adb41f876ff89b6f20cb65efc9 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,9 @@
+03Dec00=======================================================================
+1. change grepdbg and watchdbg so that you can see a number of lines before
+the condx that you are looking for so:-
+  grepdbg 3 LOOP
+  watchdbg 3 LOOP 
+will show both the LOOP line and the preceeding 2 lines.
 30Nov00=======================================================================
 1. remove %nn strings from dups of announces and spots
 2. remove check for ssids on PC41s 
index 74a623a686d159d9c5a5f7da0157129bb0e46949..66062386b0fc36dbb0ddd9c23b3460f2377e5db6 100644 (file)
@@ -1002,10 +1002,6 @@ Tell the system where you are. For example:-
 Display all the bad node callsigns in the system, see SET/BADNODE
 for more information.
 
-=== 0^SHOW/CALL <callsign>^Show any callbook details on a callsign
-This command queries an international callbook server on the internet
-and returns any information available for that callsign. 
-
 === 0^SHOW/DATE [<prefix>|<callsign>]^Show the local time 
 This is very nearly the same as SHOW/TIME, the only difference the format
 of the date string if no arguments are given.
@@ -1222,6 +1218,11 @@ example:-
 
 SH/QRA 52 41 N 0 58 E
 
+=== 0^SHOW/QRZ <callsign>^Show any callbook details on a callsign
+This command queries the QRZ callbook server on the internet
+and returns any information available for that callsign. This service
+is provided for users of this software by http://www.qrz.com 
+
 === 0^SHOW/SATELLITE <name> [<hours> <interval>]^Show tracking data
 Show the tracking data from your location to the satellite of your choice
 from now on for the next few hours.
index a126b20b8f91c7cb4efa62b1db9673f08ee10344..5aef00562c7c45c28442822a7223d431e898f369 100755 (executable)
@@ -38,7 +38,6 @@ BEGIN {
        close CLLOCK;
 }
 
-
 use Msg;
 use DXVars;
 use DXDebug;
index 250a898b5701aed2647c9e1de1822909cb48207e..a59ea742340b5f121cd5a9352d226b5e8b873514 100755 (executable)
@@ -33,17 +33,21 @@ use vars qw(@list $fp @today $string);
 
 $fp = DXLog::new('debug', 'dat', 'd');
 @today = Julian::unixtoj(time()); 
+my $nolines = 1;
+my @prev;
 
 for my $arg (@ARGV) {
        if ($arg =~ /^-/) {
                $arg =~ s/^-//o;
                push @list, $arg;
+       } elsif ($arg =~ /^\d+$/) {
+               $nolines = $arg;
        } else {
                $string = $arg;
                last;
        }
 }
-die "usage: grepdbg [[-nnn] ..] <regexp>\n" unless  $string;
+die "usage: grepdbg [nn] [[-nnn] ..] <regexp>\n" unless  $string;
 
 push @list, "0" unless @list;
 for my $entry (@list) {
@@ -54,10 +58,14 @@ for my $entry (@list) {
                while (<$fh>) {
                        my $line = $_;
                        chomp $line;
+                       push @prev, $line;
+                       shift @prev while @prev > $nolines;
                        if ($line =~ m{$string}io) {
-                               my @line =  split '\^', $line;
-                               my $t = shift @line;
-                               print atime($t), ' ', join('^', @line), "\n"; 
+                               for (@prev) {
+                                       my @line =  split '\^';
+                                       my $t = shift @line;
+                                       print atime($t), ' ', join('^', @line), "\n"; 
+                               }
                        }
                }
                $fp->close();
index 17bb3289af9f49b58c138cee19805688e759c59e..4ac24be1b02dd34c69b1d0bb9b629640a7edf400 100755 (executable)
@@ -31,7 +31,9 @@ use strict;
 my $fp = DXLog::new('debug', 'dat', 'd');
 my @today = Julian::unixtoj(time()); 
 my $fh = $fp->open(@today) or die $!; 
+my $nolines = shift if $ARGV[0] =~ /^\d+$/ || 1;
 my $exp = join '|', @ARGV;
+my @prev;
 
 # seek to end of file
 $fh->seek(0, 2);
@@ -39,13 +41,15 @@ for (;;) {
        my $line = <$fh>;
        if ($line) {
                if ($exp) {
-                       printit($line) if $line =~ m{(?:$exp)}oi;
+                       push @prev, $line;
+                       shift @prev while @prev > $nolines; 
+                       printit(@prev) if $line =~ m{(?:$exp)}oi;
                } else {
-                   printit($line);
-               }
+                       printit($line);
+               }
        } else {
                sleep(1);
-
+               
                # check that the debug hasn't rolled over to next day
                # open it if it has
                my @now = Julian::unixtoj(time()); 
@@ -64,12 +68,14 @@ for (;;) {
 
 sub printit
 {
-       my $line = shift;
-       my @line =  split '\^', $line;
-       my $t = shift @line;
-       my ($sec,$min,$hour) = gmtime((defined $t) ? $t : time);
-       my $buf = sprintf "%02d:%02d:%02d", $hour, $min, $sec;
-
-       print $buf, ' ', join('^', @line); 
+       while (@_) {
+               my $line = shift;
+               my @line =  split '\^', $line;
+               my $t = shift @line;
+               my ($sec,$min,$hour) = gmtime((defined $t) ? $t : time);
+               my $buf = sprintf "%02d:%02d:%02d", $hour, $min, $sec;
+               
+               print $buf, ' ', join('^', @line); 
+       }
 }
 exit(0);