X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/afee8ed17a56617618fb7f963b111d7cf0fb56e7..821f3da0f61239ec5990c105e77aacc7638e45eb:/uip/mhlsbr.c diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index f87c47d3..6babf510 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -288,7 +288,7 @@ static unsigned int wid; static char *ovtxt; -static unsigned char *onelp; +static char *onelp; static char *parptr; @@ -1087,19 +1087,20 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec) break; } } + m_getfld_state_destroy (&gstate); return; case LENERR: case FMTERR: advise (NULL, "format error in message %s", mname); exitstat++; + m_getfld_state_destroy (&gstate); return; default: adios (NULL, "getfld() returned %d", state); } } - m_getfld_state_destroy (&gstate); } @@ -1277,7 +1278,7 @@ static void putcomp (struct mcomp *c1, struct mcomp *c2, int flag) { int count, cchdr; - unsigned char *cp; + char *cp; cchdr = 0; lm = 0; @@ -1315,8 +1316,8 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag) if (!(c1->c_flags & HDROUTPUT) && !(c1->c_flags & NOCOMPONENT)) { if (c1->c_flags & UPPERCASE) /* uppercase component also */ for (cp = (c1->c_text ? c1->c_text : c1->c_name); *cp; cp++) - if (islower (*cp)) - *cp = toupper (*cp); + if (islower ((unsigned char) *cp)) + *cp = toupper ((unsigned char) *cp); putstr (c1->c_text ? c1->c_text : c1->c_name, c1->c_flags); if (flag != BODYCOMP) { putstr (": ", c1->c_flags); @@ -1338,8 +1339,8 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag) && !(c2->c_flags & NOCOMPONENT)) { if (c1->c_flags & UPPERCASE) for (cp = c2->c_name; *cp; cp++) - if (islower (*cp)) - *cp = toupper (*cp); + if (islower ((unsigned char) *cp)) + *cp = toupper ((unsigned char) *cp); putstr (c2->c_name, c1->c_flags); putstr (": ", c1->c_flags); if (!(c1->c_flags & SPLIT)) @@ -1352,8 +1353,8 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag) } if (c1->c_flags & UPPERCASE) for (cp = c2->c_text; *cp; cp++) - if (islower (*cp)) - *cp = toupper (*cp); + if (islower ((unsigned char) *cp)) + *cp = toupper ((unsigned char) *cp); count = 0; if (cchdr) { @@ -1400,7 +1401,7 @@ oneline (char *stuff, long flags) term = 0; if (flags & COMPRESS) { for (spc = 1, cp = ret; *onelp; onelp++) - if (isspace (*onelp)) { + if (isspace ((unsigned char) *onelp)) { if (*onelp == '\n' && (!onelp[1] || (flags & ADDRFMT))) { term = '\n'; *onelp++ = 0; @@ -1657,7 +1658,7 @@ m_popen (char *name) if (pipe (pd) == NOTOK) adios ("pipe", "unable to"); - switch (m_pid = vfork()) { + switch (m_pid = fork()) { case NOTOK: adios ("fork", "unable to"); @@ -1859,18 +1860,17 @@ filterbody (struct mcomp *c1, char *buf, int bufsz, int state, FILE *fp, */ switch (filterpid = fork()) { - char **args; + char **args, *program; struct arglist *a; - int i, dat[5], s; + int i, dat[5], s, argp; case 0: /* - * Allocate an argument array for us + * Configure an argument array for us */ - args = (char **) mh_xmalloc((filter_nargs + 2) * sizeof(char *)); - args[0] = formatproc; - args[filter_nargs + 1] = NULL; + args = argsplit(formatproc, &program, &argp); + args[argp + filter_nargs] = NULL; dat[0] = 0; dat[1] = 0; dat[2] = 0; @@ -1881,7 +1881,7 @@ filterbody (struct mcomp *c1, char *buf, int bufsz, int state, FILE *fp, * Pull out each argument and scan them. */ - for (a = arglist_head, i = 1; a != NULL; a = a->a_next, i++) { + for (a = arglist_head, i = argp; a != NULL; a = a->a_next, i++) { args[i] = mh_xmalloc(BUFSIZ); fmt_scan(a->a_fmt, args[i], BUFSIZ - 1, BUFSIZ, dat); /*