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 $!;
35 $nolines = shift if $ARGV[0] =~ /^\d+$/;
36 my $exp = join '|', @ARGV;
46 shift @prev while @prev > $nolines;
47 if ($line =~ m{(?:$exp)}oi) {
57 # check that the debug hasn't rolled over to next day
59 my @now = Julian::unixtoj(time());
60 if ($today[1] != $now[1]) {
63 for ($i = 0; $i < 20; $i++) {
64 last if $fh = $fp->open(@now);
78 $line =~ s/([\x00-\x1f\x7f-\xff])/sprintf("\\x%02X", ord($1))/eg;
79 my @line = split '\^', $line;
81 my ($sec,$min,$hour) = gmtime((defined $t) ? $t : time);
82 my $buf = sprintf "%02d:%02d:%02d", $hour, $min, $sec;
84 print $buf, ' ', join('^', @line), "\n";