-
-/*
- * 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
#include <h/fmt_scan.h>
#include <h/mts.h>
#include <h/utils.h>
+#include "sbr/terminal.h"
#define NADDRS 100
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)) {
continue;
}
}
- if (addrp > NADDRS)
+ if (addrp == NADDRS)
adios (NULL, "more than %d addresses", NADDRS);
- else
- addrs[addrp++] = cp;
+ addrs[addrp++] = cp;
}
addrs[addrp] = NULL;
status += process (addrs[addrp], width);
fmt_free (fmt, 1);
- done (status);
+ done(!!status);
return 1;
}
cptr = fmt_findcomp ("text");
if (cptr) {
- mh_xfree(cptr->c_text);
+ free(cptr->c_text);
cptr->c_text = p->pq_text;
p->pq_text = NULL;
}
cptr = fmt_findcomp ("error");
if (cptr) {
- mh_xfree(cptr->c_text);
+ free(cptr->c_text);
cptr->c_text = p->pq_error;
p->pq_error = NULL;
}
fputs (charstring_buffer (scanl), stdout);
charstring_free (scanl);
- mh_xfree(p->pq_text);
- mh_xfree(p->pq_error);
+ free(p->pq_text);
+ free(p->pq_error);
q = p->pq_next;
free(p);
}