From 55e70e76c861b5c45ae93a45d0a5da12aa849999 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Wed, 25 May 2016 19:53:35 +0100 Subject: [PATCH] Accept "exim -bp -qGname" --- doc/doc-docbook/spec.xfpt | 14 ++++++++- doc/doc-txt/NewStuff | 2 +- src/src/exim.c | 63 +++++++++++++++++---------------------- 3 files changed, 41 insertions(+), 38 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 50ce06e08..15491c3f1 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -4379,7 +4379,10 @@ relax this restriction (and also the same requirement for the &%-M%&, &%-R%&, and &%-S%& options). .cindex "queue runner" "description of operation" -The &%-q%& option starts one queue runner process. This scans the queue of +.new +If other commandline options do not specify an action, +.wen +the &%-q%& option starts one queue runner process. This scans the queue of waiting messages, and runs a delivery process for each one in turn. It waits for each delivery process to finish before starting the next one. A delivery process may not actually do any deliveries if the retry times for the addresses @@ -4475,6 +4478,15 @@ queue with the given name rather than the default queue. The name should not contain a &'/'& character. For a periodic queue run (see below) append to the name a slash and a time value. + +If other commandline options speicify an action, a &'-qG'& option +will specify a queue to operate on. +For example: +.code +exim -bp -qGquarantine +mailq -qGquarantime +exim -qGoffpeak -Rf @special.domain.example +.endd .wen .vitem &%-q%&<&'qflags'&>&~<&'start&~id'&>&~<&'end&~id'&> diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 912fe65ee..7cc6ace39 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -13,7 +13,7 @@ Version 4.88 interpreter in taint mode. 2. Facility for named queues: A commandline argument can specify - the queue name for a queue-runner, and an ACL modifier can set + the queue name for a queue operation, and an ACL modifier can set the queue to be used for a message. A $queue_name variable gives visibility. diff --git a/src/src/exim.c b/src/src/exim.c index f2ec04f04..38a1dedb6 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -3224,7 +3224,7 @@ for (i = 1; i < argc; i++) if (*argrest == 'f') { queue_run_force = TRUE; - if (*(++argrest) == 'f') + if (*++argrest == 'f') { deliver_force_thaw = TRUE; argrest++; @@ -3239,7 +3239,7 @@ for (i = 1; i < argc; i++) argrest++; } - /* -q[f][f][l][G]... Run the named queue */ + /* -q[f][f][l][G]... Work on the named queue */ if (*argrest == 'G') { @@ -3266,17 +3266,11 @@ for (i = 1; i < argc; i++) /* -q[f][f][l][G/]: Run the queue at regular intervals, optionally forced, optionally local only, optionally named. */ - else + else if ((queue_interval = readconf_readtime(*argrest ? argrest : argv[++i], + 0, FALSE)) <= 0) { - if (*argrest != 0) - queue_interval = readconf_readtime(argrest, 0, FALSE); - else - queue_interval = readconf_readtime(argv[++i], 0, FALSE); - if (queue_interval <= 0) - { - fprintf(stderr, "exim: bad time value %s: abandoned\n", argv[i]); - exit(EXIT_FAILURE); - } + fprintf(stderr, "exim: bad time value %s: abandoned\n", argv[i]); + exit(EXIT_FAILURE); } break; @@ -3296,8 +3290,7 @@ for (i = 1; i < argc; i++) if (*argrest != 0) { int i; - for (i = 0; i < sizeof(rsopts)/sizeof(uschar *); i++) - { + for (i = 0; i < nelem(rsopts); i++) if (Ustrcmp(argrest, rsopts[i]) == 0) { if (i != 2) queue_run_force = TRUE; @@ -3305,21 +3298,20 @@ for (i = 1; i < argc; i++) if (i == 1 || i == 4) deliver_force_thaw = TRUE; argrest += Ustrlen(rsopts[i]); } - } } /* -R: Set string to match in addresses for forced queue run to pick out particular messages. */ - if (*argrest == 0) + if (*argrest) + deliver_selectstring = argrest; + else if (i+1 < argc) + deliver_selectstring = argv[++i]; + else { - if (i+1 < argc) deliver_selectstring = argv[++i]; else - { - fprintf(stderr, "exim: string expected after -R\n"); - exit(EXIT_FAILURE); - } + fprintf(stderr, "exim: string expected after -R\n"); + exit(EXIT_FAILURE); } - else deliver_selectstring = argrest; break; @@ -3340,11 +3332,10 @@ for (i = 1; i < argc; i++) in all cases provided there are no further characters in this argument. */ - if (*argrest != 0) + if (*argrest) { int i; - for (i = 0; i < sizeof(rsopts)/sizeof(uschar *); i++) - { + for (i = 0; i < nelem(rsopts); i++) if (Ustrcmp(argrest, rsopts[i]) == 0) { if (i != 2) queue_run_force = TRUE; @@ -3352,21 +3343,20 @@ for (i = 1; i < argc; i++) if (i == 1 || i == 4) deliver_force_thaw = TRUE; argrest += Ustrlen(rsopts[i]); } - } } /* -S: Set string to match in addresses for forced queue run to pick out particular messages. */ - if (*argrest == 0) + if (*argrest) + deliver_selectstring_sender = argrest; + else if (i+1 < argc) + deliver_selectstring_sender = argv[++i]; + else { - if (i+1 < argc) deliver_selectstring_sender = argv[++i]; else - { - fprintf(stderr, "exim: string expected after -S\n"); - exit(EXIT_FAILURE); - } + fprintf(stderr, "exim: string expected after -S\n"); + exit(EXIT_FAILURE); } - else deliver_selectstring_sender = argrest; break; /* -Tqt is an option that is exclusively for use by the testing suite. @@ -3480,8 +3470,9 @@ for (i = 1; i < argc; i++) /* If -R or -S have been specified without -q, assume a single queue run. */ -if ((deliver_selectstring != NULL || deliver_selectstring_sender != NULL) && - queue_interval < 0) queue_interval = 0; +if ( (deliver_selectstring || deliver_selectstring_sender) + && queue_interval < 0) + queue_interval = 0; END_ARG: @@ -3502,7 +3493,7 @@ if (( bi_option || test_retry_arg >= 0 || test_rewrite_arg >= 0) ) || ( - (daemon_listen || queue_interval >= 0) && + (daemon_listen || queue_interval > 0) && (sender_address != NULL || list_options || list_queue || checking || bi_option) ) || -- 2.25.1