From 42ed39da5af85552a35626348bb77e5576e18aa4 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 6 Mar 2022 14:25:13 +0000 Subject: [PATCH] Utilities: fix exiqgrep perl syntax, add testcases. Bug 2821 Broken-by: df618101a5 --- doc/doc-docbook/spec.xfpt | 18 +++++++++-- src/exiqgrep.src | 9 ++++-- test/README | 6 ++++ test/runtest | 15 +++++++-- test/scripts/0000-Basic/0611 | 6 ++++ test/stdout/0611 | 62 ++++++++++++++++++++++++++++++++++++ 6 files changed, 108 insertions(+), 8 deletions(-) create mode 100644 test/stdout/0611 --- a/src/exiqgrep.src +++ b/src/exiqgrep.src @@ -51,16 +51,18 @@ "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n", "perl(runtime): $]\n"; exit 0; } -if (!getopts('hf:r:y:o:s:C:zxlibRcaG:',\%opt) { &help; exit;} -if ($ARGV[0]) { &help; exit;} -if ($opt{h}) { &help; exit;} +if (!getopts('hf:r:y:o:s:C:zxlibRcaG:E:',\%opt)) { &help; exit; } +if ($opt{h}) { &help; exit; } +if ($ARGV[0] || !($opt{f} || $opt{r} || $opt{s} || $opt{y} || $opt{o} || $opt{z} || $opt{x} || $opt{c})) + { &help; exit(1); } 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}; } +if ($opt{E}) { $exim = $opt{E}; } # Read message queue output into hash &collect(); # Identify which messages match selection criteria &selection(); @@ -73,10 +75,11 @@ print <<'EOF' Exim message queue display utility. -h This help message. -C Specify which exim.conf to use. + -E Specify exim binary to use. Selection criteria: -f Match sender address sender (field is "< >" wrapped) -r Match recipient address -s Match against the size field from long output --- a/doc/spec.txt +++ b/doc/spec.txt @@ -36228,13 +36228,10 @@ or (in case -a switch is specified) exim -bp -The -C option is used to specify an alternate exim.conf which might contain -alternate exim configuration the queue management might be using. - to obtain a queue listing, and then greps the output to select messages that match given criteria. The following selection options are available: -f @@ -36299,12 +36296,26 @@ -a Include delivered recipients in queue listing. -There is one more option, -h, which outputs a list of options. +The following options give alternates for configuration: + +-C config file + + is used to specify an alternate exim.conf which might contain + alternate exim configuration the queue management might be using. +-E path + + can be used to specify a path for the exim binary, + overriding the built-in one. + + +There is one more option, -h, which outputs a list of options. +At least one selection option, or either the -c or -h option, must be +given. 54.3 Summarizing the queue (exiqsumm) ------------------------------------- The exiqsumm utility is a Perl script which reads the output of "exim -bp" and