add logging of PC92A ip addresses
[spider.git] / perl / DXLogPrint.pm
index a968e53b1f818d18c9cb467faa1e6b6a98757e57..c2843ed579b22e580fc978bd81325b7ea144912b 100644 (file)
@@ -3,7 +3,7 @@
 #
 # Copyright (c) - 1998 Dirk Koopman G1TLH
 #
-# $Id$
+#
 #
 
 package DXLog;
@@ -18,11 +18,8 @@ use RingBuf;
 
 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
@@ -70,8 +67,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 +79,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);