projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add standard gcommit command
[spider.git]
/
perl
/
DXLogPrint.pm
diff --git
a/perl/DXLogPrint.pm
b/perl/DXLogPrint.pm
index a01f5dedca68f663d55f07dc69465aff42746c77..326d564e9d2207c524aa2a02522801c185edda91 100644
(file)
--- a/
perl/DXLogPrint.pm
+++ b/
perl/DXLogPrint.pm
@@
-10,18
+10,16
@@
package DXLog;
use IO::File;
use DXVars;
use IO::File;
use DXVars;
-
#use DXDebug (
);
+
use DXDebug qw(dbg isdbg
);
use DXUtil;
use DXLog;
use Julian;
use DXUtil;
use DXLog;
use Julian;
+use RingBuf;
use strict;
use strict;
-use vars qw($VERSION $BRANCH);
-$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
-$main::build += $VERSION;
-$main::branch += $BRANCH;
+use vars qw($maxmonths);
+$maxmonths = 36;
#
# print some items from the log backwards in time
#
# print some items from the log backwards in time
@@
-32,7
+30,7
@@
sub print
{
my $fcb = $DXLog::log;
my $from = shift || 0;
{
my $fcb = $DXLog::log;
my $from = shift || 0;
- my $to = shift ||
2
0;
+ my $to = shift ||
1
0;
my $jdate = $fcb->unixtoj(shift);
my $pattern = shift;
my $who = uc shift;
my $jdate = $fcb->unixtoj(shift);
my $pattern = shift;
my $who = uc shift;
@@
-46,7
+44,7
@@
sub print
if ($pattern) {
$hint = "m{\\Q$pattern\\E}i";
} else {
if ($pattern) {
$hint = "m{\\Q$pattern\\E}i";
} else {
- $hint = "!m{
ann|rcmd|talk
}";
+ $hint = "!m{
\\^(?:ann|rcmd|talk|chat)\\^
}";
}
if ($who) {
$hint .= ' && ' if $hint;
}
if ($who) {
$hint .= ' && ' if $hint;
@@
-59,27
+57,37
@@
sub print
$eval = qq(while (<\$fh>) {
$hint;
chomp;
$eval = qq(while (<\$fh>) {
$hint;
chomp;
-
push \@tmp, \$_
;
+
\$ring->write(\$_)
;
} );
} );
+ if (isdbg('search')) {
+ dbg("sh/log hint: $hint");
+ dbg("sh/log eval: $eval");
+ }
+
$fcb->close; # close any open files
$fcb->close; # close any open files
+ my $months;
my $fh = $fcb->open($jdate);
my $fh = $fcb->open($jdate);
- L1: for (
;@in < $to;
) {
+ L1: for (
$months = 0; $months < $maxmonths && @in < $tot; $months++
) {
my $ref;
my $ref;
+ my $ring = RingBuf->new($tot);
+
if ($fh) {
my @tmp;
eval $eval; # do the search on this file
return ("Log search error", $@) if $@;
if ($fh) {
my @tmp;
eval $eval; # do the search on this file
return ("Log search error", $@) if $@;
- @in = (@tmp, @in);
- if (@in > $to) {
- @in = splice @in, -$to, $to;
- last L1;
- }
+
+ @in = ($ring->readall, @in);
+ last L1 if @in >= $tot;
}
}
+
$fh = $fcb->openprev(); # get the next file
last if !$fh;
}
$fh = $fcb->openprev(); # get the next file
last if !$fh;
}
+
+ @in = splice @in, -$tot, $tot if @in > $tot;
+
for (@in) {
my @line = split /\^/ ;
push @out, print_item(\@line);
for (@in) {
my @line = split /\^/ ;
push @out, print_item(\@line);
@@
-88,6
+96,7
@@
sub print
return @out;
}
return @out;
}
+
#
# the standard log printing interpreting routine.
#
#
# the standard log printing interpreting routine.
#
@@
-115,8
+124,9
@@
sub print_item
} elsif ($r->[1] eq 'talk') {
$r->[5] ||= "";
$s = "$r->[3] -> $r->[2] ($r->[4]) $r->[5]";
} elsif ($r->[1] eq 'talk') {
$r->[5] ||= "";
$s = "$r->[3] -> $r->[2] ($r->[4]) $r->[5]";
- } elsif ($r->[1] eq 'ann') {
+ } elsif ($r->[1] eq 'ann'
|| $r->[1] eq 'chat'
) {
$r->[4] ||= "";
$r->[4] ||= "";
+ $r->[4] =~ s/^\#\d+ //;
$s = "$r->[3] -> $r->[2] $r->[4]";
} else {
$r->[2] ||= "";
$s = "$r->[3] -> $r->[2] $r->[4]";
} else {
$r->[2] ||= "";