exipick: support for named queues
[exim.git] / src / src / exipick.src
index a1aa79dc064b440acea4a56ebe304910107bec2a..86a010c86bb000f33af17e9a1b741ab0f4e08c73 100644 (file)
@@ -1,5 +1,5 @@
 #!PERL_COMMAND
-# Copyright (c) 2017 University of Cambridge.
+# Copyright (c) 1995 - 2018 University of Cambridge.
 # See the file NOTICE for conditions of use and distribution.
 
 
@@ -17,6 +17,7 @@ my $charset = 'ISO-8859-1';
 use strict;
 BEGIN { pop @INC if $INC[-1] eq '.' };
 use Getopt::Long;
+use File::Basename;
 
 my($p_name)   = $0 =~ m|/?([^/]+)$|;
 my $p_version = "20100323.0";
@@ -47,6 +48,7 @@ GetOptions(
   'spool=s'     => \$G::spool,      # exim spool dir
   'C|Config=s'  => \$G::config,     # use alternative Exim configuration file
   'input-dir=s' => \$G::input_dir,  # name of the "input" dir
+  'queue=s'     => \$G::queue,      # name of the queue
   'finput'      => \$G::finput,     # same as "--input-dir Finput"
   'bp'          => \$G::mailq_bp,   # List the queue (noop - default)
   'bpa'         => \$G::mailq_bpa,  # ... with generated address as well
@@ -83,7 +85,13 @@ GetOptions(
   'show-vars=s' => \$G::show_vars,  # display the contents of these vars
   'just-vars'   => \$G::just_vars,  # only display vars, no other info
   'show-rules'  => \$G::show_rules, # display compiled match rules
-  'show-tests'  => \$G::show_tests  # display tests as applied to each message
+  'show-tests'  => \$G::show_tests, # display tests as applied to each message
+  'version'     => sub {
+        print basename($0) . ": $0\n",
+            "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+            "perl(runtime): $]\n";
+            exit 0;
+  },
 ) || exit(1);
 
 # if both freeze and thaw specified, only thaw as it is less destructive
@@ -121,7 +129,8 @@ $G::caseless        = $G::caseful ? 0 : 1; # nocase by default, case if both
 $spool              = defined $G::spool ? $G::spool
                      : do { chomp($_ = `$exim @{[defined $G::config ? "-C $G::config" : '']} -n -bP spool_directory`)
                              and $_ or $spool };
-my $input_dir       = $G::input_dir || ($G::finput ? "Finput" : "input");
+my $input_dir       = (defined $G::queue ? "$G::queue/" : '')
+                    . (defined $G::input_dir || ($G::finput ? "Finput" : "input"));
 my $count_only      = 1 if ($G::mailq_bpc  || $G::qgrep_c);
 my $unsorted        = 1 if ($G::mailq_bpr  || $G::mailq_bpra ||
                             $G::mailq_bpru || $G::unsorted);
@@ -1419,6 +1428,10 @@ Same as '$message_age > <seconds>' (exiqgrep)
 
 Display messages matching any criteria
 
+=item --queue <name>
+
+Name of the queue (default: ''). See "named queues" in the spec.
+
 =item -R
 
 Same as --reverse (exiqgrep)