X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/d321a6ee82fce5d187f4342199c090909a72e9b8..fcaa3047b2a23fc0c36be518d1ca1ea0b0cb3b66:/uip/rcvdist.c diff --git a/uip/rcvdist.c b/uip/rcvdist.c index 531518d8..b6594a4f 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -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 ...", @@ -271,7 +273,7 @@ rcvdistout (FILE *inb, char *form, char *addrs) switch (state = m_getfld2(&gstate, name, tmpbuf, &msg_count)) { case FLD: case FLDPLUS: - i = fmt_addcomptext(name, tmpbuf); + i = fmt_addcomptext(name, tmpbuf); if (i != -1) { char_read += msg_count; while (state == FLDPLUS) {