X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/9fce8ab3a8a0134261cb796add60a1248e8ae38f..9e4dbc2d5379b96a8d90e28cf8fce803d6cc1ff4:/uip/ap.c diff --git a/uip/ap.c b/uip/ap.c index bfec3429..a44ecf55 100644 --- a/uip/ap.c +++ b/uip/ap.c @@ -1,6 +1,4 @@ - -/* - * ap.c -- parse addresses 822-style +/* ap.c -- parse addresses 822-style * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -51,14 +49,13 @@ main (int argc, char **argv) int width = -1, status = 0; char *cp, *form = NULL, *format = NULL, *nfs; char buf[BUFSIZ], **argp; - char **arguments, *addrs[NADDRS]; + char *addrs[NADDRS + 1]; /* Includes terminating NULL. */ if (nmh_init(argv[0], 2)) { return 1; } mts_init (); - arguments = getarguments (invo_name, argc, argv, 1); - argp = arguments; + argp = getarguments (invo_name, argc, argv, 1); while ((cp = *argp++)) { if (*cp == '-') { switch (smatch (++cp, switches)) { @@ -96,10 +93,9 @@ main (int argc, char **argv) continue; } } - if (addrp > NADDRS) + if (addrp == NADDRS) adios (NULL, "more than %d addresses", NADDRS); - else - addrs[addrp++] = cp; + addrs[addrp++] = cp; } addrs[addrp] = NULL; @@ -131,7 +127,7 @@ main (int argc, char **argv) status += process (addrs[addrp], width); fmt_free (fmt, 1); - done (status); + done(min(status, MAX_EXIT)); return 1; } @@ -192,7 +188,7 @@ process (char *arg, int length) mh_xfree(p->pq_text); mh_xfree(p->pq_error); q = p->pq_next; - free ((char *) p); + free(p); } return status;