counter added
authorheiko
Wed, 03 Jan 2007 17:15:15 +0000
changeset 34 57bee7e4f4cf
parent 33 cbff5ff61a0e
child 35 f4701d2fcda7
counter added
exigrey.pl
exim-exigrey.pl
--- a/exigrey.pl	Wed Jan 03 16:58:30 2007 +0000
+++ b/exigrey.pl	Wed Jan 03 17:15:15 2007 +0000
@@ -63,17 +63,19 @@
 	print; exit 0;
     };
 
-
     if ($opt_list) {
-	my %h;
-	connectDB(\%h, shift);
-	iterate(%h, sub {
-	    my ($item, $v0, $v1, $c) = @_;
-	    printf "%-16s:\t$v0 $v1 (%3d %s %s)\n", 
-		    $item, $c,
-		    strftime("%F %T", localtime($v0)), 
-		    strftime("%F %T", localtime($v1));
-	});
+	foreach (@ARGV = getDBs(@ARGV)) {
+	    my %h;
+	    my $db = connectDB(\%h, $_);
+	    print "# $db\n";
+	    iterate(%h, sub {
+		my ($item, $v0, $v1, $c) = @_;
+		printf "$item: $v0 $v1 $c (%s %s)\n", 
+			strftime("%FT%T", localtime($v0)), 
+			strftime("%FT%T", localtime($v1));
+	    });
+	    print "\n" if @ARGV;
+	}
 	exit 0;
     }
 
--- a/exim-exigrey.pl	Wed Jan 03 16:58:30 2007 +0000
+++ b/exim-exigrey.pl	Wed Jan 03 17:15:15 2007 +0000
@@ -55,7 +55,7 @@
 		$h{$item} = "$now $now 0\0";
 		$rc = "yes";
 	} else {
-		my ($created, $used, $count) = split " ", $h{$item}
+		my ($created, $used, $count) = split " ", $h{$item};
 		if ($now - $created < $delay) { $rc = "yes" }
 		else { 
 			$rc = "no";