]> diplodocus.org Git - nmh/commitdiff
Also trap ambiguous post switch.
authorDavid Levine <levinedl@acm.org>
Mon, 15 Jan 2018 22:30:49 +0000 (17:30 -0500)
committerDavid Levine <levinedl@acm.org>
Mon, 15 Jan 2018 22:34:05 +0000 (17:34 -0500)
Fix to commit d321a6ee82fce5d187f4342199c090909a72e9b8.

NEWS
uip/rcvdist.c

diff --git a/NEWS b/NEWS
index b6159fa8f4b8cc5fcc60309264be80bf0b09a73f..b45988738cd331b7449889ea7c07bc1cd207497d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -128,6 +128,7 @@ BUG FIXES
 - scan can now handle empty files without violating an assert [Bug #51693].
 - An error when writing an error message, e.g. EPIPE, no longer causes
   recursion until the stack is exhausted.
+- rcvdist(1) now passes switch arguments to post(8).
 
 -------------------
 DEPRECATED FEATURES
index 531518d8dd54efe8466a410534b28806f93938f5..fcf9dd77943cbaf9ef1e1429047ccc818682e810 100644 (file)
@@ -85,7 +85,7 @@ DEFINE_SWITCH_ENUM(POST);
 #undef X
 
 #define X(sw, minchars, id) { sw, minchars, id },
-DEFINE_SWITCH_ARRAY(POST, post_switches);
+DEFINE_SWITCH_ARRAY(POST, post_switches_with_args);
 #undef X
 
 static char backup[BUFSIZ] = "";
@@ -130,17 +130,19 @@ main (int argc, char **argv)
                case AMBIGSW: 
                    ambigsw (cp, switches);
                    done (1);
-               case UNKWNSW: 
+               case UNKWNSW: {
+                   const int argno = smatch(cp, post_switches_with_args);
                    vec[vecp++] = --cp;
-                   if (smatch(cp + 1, post_switches) != UNKWNSW) {
+                   if (argno != AMBIGSW && argno != UNKWNSW) {
                        /* It's a post switch that does take an argument. */
                        if (!(cp = *argp) || *cp == '-') {
                            die("missing argument to %s", argp[-1]);
                        }
-                        vec[vecp++] = *argp++;
+                       vec[vecp++] = cp;
+                       ++argp;
                    }
                    continue;
-
+               }
                case HELPSW: 
                    snprintf (buf, sizeof(buf),
                        "%s [switches] [switches for postproc] address ...",