ph10 2007/03/13 11:06:48 GMT
Modified files:
exim-doc/doc-txt ChangeLog NewStuff
exim-src ACKNOWLEDGMENTS
exim-src/src exigrep.src
Log:
Add -v functionality to exigrep.
Revision Changes Path
1.491 +2 -0 exim/exim-doc/doc-txt/ChangeLog
1.144 +3 -0 exim/exim-doc/doc-txt/NewStuff
1.76 +1 -0 exim/exim-src/ACKNOWLEDGMENTS
1.7 +18 -7 exim/exim-src/src/exigrep.src
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.490
retrieving revision 1.491
diff -u -r1.490 -r1.491
--- ChangeLog 13 Mar 2007 10:05:16 -0000 1.490
+++ ChangeLog 13 Mar 2007 11:06:48 -0000 1.491
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.490 2007/03/13 10:05:16 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.491 2007/03/13 11:06:48 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -153,6 +153,8 @@
cpus.
PH/35 Applied a patch from the Sieve maintainer which fixes a bug in "notify".
+
+PH/36 Applied John Jetmore's patch to add -v functionality to exigrep.
Exim version 4.66
Index: NewStuff
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
--- NewStuff 26 Feb 2007 14:07:04 -0000 1.143
+++ NewStuff 13 Mar 2007 11:06:48 -0000 1.144
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.143 2007/02/26 14:07:04 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.144 2007/03/13 11:06:48 ph10 Exp $
New Features in Exim
--------------------
@@ -390,6 +390,9 @@
doubling, it is not possible to include a control character as data when it
is set as the separator. Two such characters in succession are interpreted
as enclosing an empty list item.
+
+19. The exigrep utility now has a -v option, which inverts the matching
+ condition.
Version 4.66
Index: ACKNOWLEDGMENTS
===================================================================
RCS file: /home/cvs/exim/exim-src/ACKNOWLEDGMENTS,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- ACKNOWLEDGMENTS 13 Mar 2007 09:50:22 -0000 1.75
+++ ACKNOWLEDGMENTS 13 Mar 2007 11:06:48 -0000 1.76
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-src/ACKNOWLEDGMENTS,v 1.75 2007/03/13 09:50:22 ph10 Exp $
+$Cambridge: exim/exim-src/ACKNOWLEDGMENTS,v 1.76 2007/03/13 11:06:48 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
@@ -180,6 +180,7 @@
Much helpful testing of the test suite & elsewhere
Patch for -Mset
Patch for TLS testing with -bh/-bhc/-bs
+ Patch for exigrep -v functionality
Bob Johannessen Patch for Sieve envelope tests bug
Patch for negative uid/gid bug
Brad Jorsch Patch for bitwise logical operators
Index: exigrep.src
===================================================================
RCS file: /home/cvs/exim/exim-src/src/exigrep.src,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- exigrep.src 14 Feb 2007 16:44:22 -0000 1.6
+++ exigrep.src 13 Mar 2007 11:06:48 -0000 1.7
@@ -1,5 +1,5 @@
#! PERL_COMMAND -w
-# $Cambridge: exim/exim-src/src/exigrep.src,v 1.6 2007/02/14 16:44:22 ph10 Exp $
+# $Cambridge: exim/exim-src/src/exigrep.src,v 1.7 2007/03/13 11:06:48 ph10 Exp $
use strict;
@@ -59,7 +59,7 @@
# This subroutine processes a single line (in $_) from a log file. Program
# defensively against short lines finding their way into the log.
-my (%saved, %id_list, $pattern, $queue_time, $insensitive);
+my (%saved, %id_list, $pattern, $queue_time, $insensitive, $invert);
sub do_line {
@@ -84,8 +84,16 @@
# Are we interested in this id ? Short circuit if we already were interested.
- $id_list{$id} = 1 if defined $id_list{$id} ||
- ($insensitive && /$pattern/io) || /$pattern/o;
+ if ($invert)
+ {
+ $id_list{$id} = 1 if (!defined($id_list{$id}));
+ $id_list{$id} = 0 if (($insensitive && /$pattern/io) || /$pattern/o);
+ }
+ else
+ {
+ $id_list{$id} = 1 if defined $id_list{$id} ||
+ ($insensitive && /$pattern/io) || /$pattern/o;
+ }
# See if this is a completion for some message. If it is interesting,
# print it, but in any event, throw away what was saved.
@@ -108,6 +116,7 @@
print "$saved{$id}\n";
}
+ delete $id_list{$id};
delete $saved{$id};
}
}
@@ -115,7 +124,8 @@
# Handle the case where the log line does not belong to a specific message.
# Print it if it is interesting.
-elsif (($insensitive && $_ =~ /$pattern/io) || $_ =~ /$pattern/o)
+elsif ( ($invert && (($insensitive && !/$pattern/io) || !/$pattern/o)) ||
+ (!$invert && (($insensitive && /$pattern/io) || /$pattern/o)) )
{ print "$_\n"; }
}
@@ -124,11 +134,12 @@
# are quoted if the -l flag is given. The -t flag gives a time-on-queue value
# which is an additional condition.
-getopts('Ilt:',\my %args);
-$queue_time = $args{'t'}? $args{'t'} : -1;
+getopts('Ilvt:',\my %args);
+$queue_time = $args{'t'}? $args{'t'} : -1;
$insensitive = $args{'I'}? 0 : 1;
+$invert = $args{'v'}? 1 : 0;
-die "usage: exigrep [-I] [-l] [-t <seconds>] <pattern> [<log file>]...\n"
+die "usage: exigrep [-I] [-l] [-t <seconds>] [-v] <pattern> [<log file>]...\n"
if ($#ARGV < 0);
$pattern = shift @ARGV;