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);
40 $search = '1' unless $pattern || $who;
42 $search = "\$ref->[1] =~ m{$pattern}i";
43 $hint = "m{$pattern}i";
51 $search .= "(\$ref->[2] =~ m{$who}i || \$ref->[3] =~ m{$who}i)";
54 $hint = "next unless $hint" if $hint;
61 \$ref = [ split '\\^' ];
62 push \@\$ref, "" unless \@\$ref >= 4;
66 for (\$c = \$#in; \$c >= 0; \$c--) {
70 next if \$count < $from;
71 push \@out, print_item(\$ref);
72 last if \$count >= \$to; # stop after n
77 $fcb->close; # close any open files
79 my $fh = $fcb->open(@date);
80 for ($count = 0; $count < $to; ) {
83 eval $eval; # do the search on this file
84 last if $count >= $to; # stop after n
85 return ("Log search error", $@) if $@;
87 $fh = $fcb->openprev(); # get the next file
95 # the standard log printing interpreting routine.
97 # every line that is printed should call this routine to be actually visualised
99 # Don't really know whether this is the correct place to put this stuff, but where
102 # I get a reference to an array of items
108 my $d = atime($ref[0]);
111 if ($ref[1] eq 'rcmd') {
112 if ($ref[2] eq 'in') {
113 $s = "$ref[4] (priv: $ref[3]) rcmd: $ref[5]";
115 $s = "$ref[3] reply: $ref[4]";
117 } elsif ($ref[1] eq 'talk') {
118 $s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
119 } elsif ($ref[1] eq 'ann') {
120 $s = "$ref[3] -> $ref[2] $ref[4]";