X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXLogPrint.pm;h=356c7cd1efb3dd44c9904dd587a35aaa9087e5bd;hb=ee3201c65017b91e2e42e8792b4db7c9c1122ae5;hp=a968e53b1f818d18c9cb467faa1e6b6a98757e57;hpb=9cc26cc7a73efb7679d3e8e819ba0019307f8607;p=spider.git diff --git a/perl/DXLogPrint.pm b/perl/DXLogPrint.pm index a968e53b..356c7cd1 100644 --- a/perl/DXLogPrint.pm +++ b/perl/DXLogPrint.pm @@ -18,12 +18,14 @@ use RingBuf; use strict; -use vars qw($VERSION $BRANCH); +use vars qw($VERSION $BRANCH $maxmonths); $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; +$maxmonths = 36; + # # print some items from the log backwards in time # @@ -70,8 +72,9 @@ sub print $fcb->close; # close any open files + my $months; my $fh = $fcb->open($jdate); - L1: for (;@in < $to;) { + L1: for ($months = 0; $months < $maxmonths && @in < $tot; $months++) { my $ref; my $ring = RingBuf->new($tot); @@ -81,12 +84,15 @@ sub print return ("Log search error", $@) if $@; @in = ($ring->readall, @in); - last L1 if @in > $tot; + last L1 if @in >= $tot; } $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);