From: minima Date: Sun, 3 Dec 2000 13:48:26 +0000 (+0000) Subject: change watchdbg and grepdbg to show preceeding lines X-Git-Tag: R_1_45~11 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=f18a5bbaecbb46d84daa3cfa7968697fb87da742;p=spider.git change watchdbg and grepdbg to show preceeding lines remove sh/call from help --- diff --git a/Changes b/Changes index 4bf36d1e..1745e0f0 100644 --- 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 diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 74a623a6..66062386 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -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 ^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 [|]^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 ^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 [ ]^Show tracking data Show the tracking data from your location to the satellite of your choice from now on for the next few hours. diff --git a/perl/cluster.pl b/perl/cluster.pl index a126b20b..5aef0056 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -38,7 +38,6 @@ BEGIN { close CLLOCK; } - use Msg; use DXVars; use DXDebug; diff --git a/perl/grepdbg b/perl/grepdbg index 250a898b..a59ea742 100755 --- a/perl/grepdbg +++ b/perl/grepdbg @@ -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] ..] \n" unless $string; +die "usage: grepdbg [nn] [[-nnn] ..] \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(); diff --git a/perl/watchdbg b/perl/watchdbg index 17bb3289..4ac24be1 100755 --- a/perl/watchdbg +++ b/perl/watchdbg @@ -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);