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";
54 $hint .= 'm{\\Q$who\\E}i';
56 $hint = "next unless $hint" if $hint;
64 shift \@in, if \@in > $tot;
68 $fcb->close; # close any open files
70 my $fh = $fcb->open($jdate);
71 L1: for ($count = 0; $count < $to; ) {
74 eval $eval; # do the search on this file
75 return ("Log search error", $@) if $@;
78 last L1 if $count >= $to;
79 my $ref = [ split /\^/, shift @in ];
80 next if defined $pattern && $ref->[1] ne $pattern;
81 push @tmp, print_item($ref);
86 $fh = $fcb->openprev(); # get the next file
94 # the standard log printing interpreting routine.
96 # every line that is printed should call this routine to be actually visualised
98 # Don't really know whether this is the correct place to put this stuff, but where
101 # I get a reference to an array of items
107 my $d = atime($ref[0]);
110 if ($ref[1] eq 'rcmd') {
111 if ($ref[2] eq 'in') {
112 $s = "$ref[4] (priv: $ref[3]) rcmd: $ref[5]";
114 $s = "$ref[3] reply: $ref[4]";
116 } elsif ($ref[1] eq 'talk') {
117 $s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
118 } elsif ($ref[1] eq 'ann') {
119 $s = "$ref[3] -> $ref[2] $ref[4]";