X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/dbbbe1b73d4eba1f4d0d55ccab54f2f7130f395d..ef1ba39e8dae81091b6c3e73e72825ef6edea3c6:/uip/slocal.c diff --git a/uip/slocal.c b/uip/slocal.c index 6bbcde6a..772c4e2b 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -423,7 +423,7 @@ usr_delivery (int fd, char *delivery, int su) int i, accept, status=1, won, vecp, next; char *field, *pattern, *action, *result, *string; char buffer[BUFSIZ], tmpbuf[BUFSIZ]; - char *cp, *vec[NVEC]; + char *vec[NVEC]; struct stat st; struct pair *p; FILE *fp; @@ -452,9 +452,7 @@ usr_delivery (int fd, char *delivery, int su) if (*buffer == '#' || *buffer == '\n') continue; - /* zap trailing newline */ - if ((cp = strchr(buffer, '\n'))) - *cp = 0; + TrimSuffixC(buffer, '\n'); /* split buffer into fields */ vecp = split (buffer, vec); @@ -763,7 +761,7 @@ parse (int fd) } } if (p->p_name == NULL && i < NVEC) { - p->p_name = getcpy (name); + p->p_name = mh_xstrdup(name); p->p_value = lp; p->p_flags = P_NIL; p++, i++; @@ -874,7 +872,7 @@ glob (int fd) if ((p = lookup (vars, "size"))) { snprintf (buffer, sizeof(buffer), "%d", fstat (fd, &st) != -1 ? (int) st.st_size : 0); - p->p_value = getcpy (buffer); + p->p_value = mh_xstrdup(buffer); } if ((p = lookup (vars, "info"))) p->p_value = getcpy (info); @@ -1127,16 +1125,15 @@ usr_pipe (int fd_arg, char *cmd, char *pgm, char **vec, int suppress) pidstatus (status, stdout, ", failed"); } return (status == 0 ? 0 : -1); - } else { - /* - * Ruthlessly kill the child and anything - * else in its process group. - */ - killpg(child_id, SIGKILL); - if (verbose) - verbose_printf (", timed-out; terminated\n"); - return -1; } + /* + * Ruthlessly kill the child and anything + * else in its process group. + */ + killpg(child_id, SIGKILL); + if (verbose) + verbose_printf (", timed-out; terminated\n"); + return -1; } } @@ -1163,11 +1160,11 @@ get_sender (char *envelope, char **sender) char buffer[BUFSIZ]; if (envelope == NULL) { - *sender = getcpy (""); + *sender = mh_xstrdup(""); return; } - i = strlen ("From "); + i = LEN("From "); strncpy (buffer, envelope + i, sizeof(buffer)); if ((cp = strchr(buffer, '\n'))) { *cp = 0; @@ -1184,7 +1181,7 @@ get_sender (char *envelope, char **sender) *cp = 0; else break; - *sender = getcpy (buffer); + *sender = mh_xstrdup(buffer); } @@ -1253,13 +1250,13 @@ you_lose: * and massage the headers. Save * a copy of the "From " line for later. */ - i = strlen ("From "); + i = LEN("From "); while (fgets (buffer, sizeof(buffer), qfp)) { if (first) { first = 0; if (!strncmp (buffer, "From ", i)) { /* get copy of envelope information ("From " line) */ - envelope = getcpy (buffer); + envelope = mh_xstrdup(buffer); /* Put the delivery date in message */ fputs (ddate, ffp); @@ -1328,7 +1325,7 @@ trim (char *cp) *sp = ' '; /* now return a copy */ - return getcpy(bp); + return mh_xstrdup(bp); } /*