2 # Log Printing routines
4 # Copyright (c) - 1998 Dirk Koopman G1TLH
21 # print some items from the log backwards in time
23 # This command outputs a list of n lines starting from time t with $pattern tags
27 my $fcb = $DXLog::log;
30 my @date = Julian::unixtojm(shift);
39 $search = '1' unless $pattern || $who;
40 $search = "\$ref->[1] =~ /$pattern/" if $pattern;
41 $search .= ' && ' if $pattern && $who;
42 $search .= "(\$ref->[2] =~ /$who/ || \$ref->[3] =~ /$who/)" if $who;
46 for (\$c = \$#in; \$c >= 0; \$c--) {
50 next if \$count < $from;
51 push \@out, print_item(\$ref);
52 last if \$count >= \$to; # stop after n
57 $fcb->close; # close any open files
59 my $fh = $fcb->open(@date);
60 for ($count = 0; $count < $to; ) {
66 $ref = [ split '\^' ];
67 push @{$ref}, "" unless @{$ref} >= 4;
70 eval $eval; # do the search on this file
71 last if $count >= $to; # stop after n
72 return ("Log search error", $@) if $@;
74 $fh = $fcb->openprev(); # get the next file
82 # the standard log printing interpreting routine.
84 # every line that is printed should call this routine to be actually visualised
86 # Don't really know whether this is the correct place to put this stuff, but where
89 # I get a reference to an array of items
95 my $d = atime($ref[0]);
98 if ($ref[1] eq 'rcmd') {
99 if ($ref[2] eq 'in') {
100 $s = "$ref[4] (priv: $ref[3]) rcmd: $ref[5]";
102 $s = "$ref[3] reply: $ref[4]";
104 } elsif ($ref[1] eq 'talk') {
105 $s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
106 } elsif ($ref[1] eq 'ann') {
107 $s = "$ref[3] -> $ref[2] $ref[4]";