3 # watch the end of the current debug file (like tail -f) applying
4 # any regexes supplied on the command line.
8 # watchdbg g1tlh # watch everything g1tlh does
9 # watchdbg gb7baa gb7djk # watch the conversation between BAA and DJK
14 # search local then perl directories
16 # root of directory tree for this system
18 $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
20 unshift @INC, "$root/perl"; # this IS the right way round!
21 unshift @INC, "$root/local";
31 my $fp = DXLog::new('debug', 'dat', 'd');
32 my @today = Julian::unixtoj(time());
33 my $fh = $fp->open(@today) or die $!;
34 my $nolines = shift if $ARGV[0] =~ /^\d+$/ || 1;
35 my $exp = join '|', @ARGV;
45 shift @prev while @prev > $nolines;
46 printit(@prev) if $line =~ m{(?:$exp)}oi;
53 # check that the debug hasn't rolled over to next day
55 my @now = Julian::unixtoj(time());
56 if ($today[1] != $now[1]) {
59 for ($i = 0; $i < 20; $i++) {
60 last if $fh = $fp->open(@now);
73 my @line = split '\^', $line;
75 my ($sec,$min,$hour) = gmtime((defined $t) ? $t : time);
76 my $buf = sprintf "%02d:%02d:%02d", $hour, $min, $sec;
78 print $buf, ' ', join('^', @line);