X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=blobdiff_plain;f=src%2Fsrc%2Fexiqgrep.src;h=c8762df479da01279db8d73d9a4a1ad3a57ecd93;hp=05c1b9ed06ef9ee43212ef9ef1e39798ce71a495;hb=129a5d133927ff8fa4b3f941f83c022d2daf18f3;hpb=c0c4d23c07e2356baae2bd2c6d72339db117b9e6 diff --git a/src/src/exiqgrep.src b/src/src/exiqgrep.src index 05c1b9ed0..c8762df47 100644 --- a/src/src/exiqgrep.src +++ b/src/src/exiqgrep.src @@ -18,7 +18,10 @@ # Version 1.2 use strict; +BEGIN { pop @INC if $INC[-1] eq '.' }; + use Getopt::Std; +use File::Basename; # Have this variable point to your exim binary. my $exim = 'BIN_DIRECTORY/exim'; @@ -43,9 +46,19 @@ if ($^O eq 'darwin') { # aka MacOS X $base = 62; }; -getopts('hf:r:y:o:s:zxlibRca',\%opt); +if ($ARGV[0] eq '--version') { + print basename($0) . ": $0\n", + "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n", + "perl(runtime): $]\n"; + exit 0; +} + +getopts('hf:r:y:o:s:C:zxlibRcaG:',\%opt); +if ($ARGV[0]) { &help; exit;} if ($opt{h}) { &help; exit;} if ($opt{a}) { $eargs = '-bp'; } +if ($opt{C} && -e $opt{C} && -f $opt{C} && -R $opt{C}) { $eargs .= ' -C '.$opt{C}; } +if ($opt{G}) { $eargs .= ' -qG'.$opt{G}; } # Read message queue output into hash &collect(); @@ -61,6 +74,7 @@ sub help() { Exim message queue display utility. -h This help message. + -C Specify which exim.conf to use. Selection criteria: -f Match sender address sender (field is "< >" wrapped) @@ -70,6 +84,7 @@ Selection criteria: -o Message older than -z Frozen messages only (exclude non-frozen) -x Non-frozen messages only (exclude frozen) + -G Match in given queue only [ NB: for regexps, provided string sits in // ] @@ -84,7 +99,7 @@ EOF } sub collect() { - open(QUEUE,"$exim $eargs |") or die("Error openning pipe: $!\n"); + open(QUEUE,"$exim $eargs |") or die("Error opening pipe: $!\n"); while() { chomp(); my $line = $_;