2 # Log Printing routines
4 # Copyright (c) - 1998 Dirk Koopman G1TLH
20 use vars qw($VERSION $BRANCH);
21 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
22 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0;
23 $main::build += $VERSION;
24 $main::branch += $BRANCH;
27 # print some items from the log backwards in time
29 # This command outputs a list of n lines starting from time t with $pattern tags
33 my $fcb = $DXLog::log;
34 my $from = shift || 0;
37 my $jdate = $fcb->unixtoj(shift);
44 my $tot = $from + $to;
48 $hint = "m{\\Q$pattern\\E}i";
50 $hint = "!m{ann|rcmd|talk}";
56 $hint .= 'm{\\Q$who\\E}i';
58 $hint = "next unless $hint" if $hint;
66 shift \@in, if \@in > $tot;
70 $fcb->close; # close any open files
72 my $fh = $fcb->open($jdate);
73 L1: for ($count = 0; $count < $to; ) {
76 eval $eval; # do the search on this file
77 return ("Log search error", $@) if $@;
80 last L1 if $count >= $to;
81 my $ref = [ split /\^/, shift @in ];
82 next if defined $pattern && $ref->[1] ne $pattern;
83 push @tmp, print_item($ref);
88 $fh = $fcb->openprev(); # get the next file
96 # the standard log printing interpreting routine.
98 # every line that is printed should call this routine to be actually visualised
100 # Don't really know whether this is the correct place to put this stuff, but where
103 # I get a reference to an array of items
109 my $d = atime($ref[0]);
112 if ($ref[1] eq 'rcmd') {
113 if ($ref[2] eq 'in') {
114 $s = "$ref[4] (priv: $ref[3]) rcmd: $ref[5]";
116 $s = "$ref[3] reply: $ref[4]";
118 } elsif ($ref[1] eq 'talk') {
119 $s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
120 } elsif ($ref[1] eq 'ann') {
121 $s = "$ref[3] -> $ref[2] $ref[4]";