X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Frcvdist.c;h=7ee47fd92e0ce748b48f75bba9ec99716b43287d;hp=ace5295df3c51f5285942ac5d446cf506bf8c4eb;hb=d8916ff5d389de5ab225cd6f40aeda1b285d0f28;hpb=017a82124bf2ea39ced5aa4c8f969c18b3c2fb90 diff --git a/uip/rcvdist.c b/uip/rcvdist.c index ace5295..7ee47fd 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -3,13 +3,18 @@ * rcvdist.c -- asynchronously redistribute messages * * $Id$ + * + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include #include #include -#include -#include +#include +#include +#include static struct swit switches[] = { #define FORMSW 0 @@ -29,7 +34,7 @@ static char tmpfil[BUFSIZ] = ""; * prototypes */ static void rcvdistout (FILE *, char *, char *); -int done (int); +static void unlink_done (int) NORETURN; int @@ -41,6 +46,8 @@ main (int argc, char **argv) char **argp, **arguments, *vec[MAXARGS]; register FILE *fp; + done=unlink_done; + #ifdef LOCALE setlocale(LC_ALL, ""); #endif @@ -177,8 +184,7 @@ rcvdistout (FILE *inb, char *form, char *addrs) *--savecomp = 0; for (i = ncomps; i--;) - if (!(*nxtbuf++ = malloc (SBUFSIZ))) - adios (NULL, "unable to allocate component buffer"); + *nxtbuf++ = mh_xmalloc (SBUFSIZ); nxtbuf = compbuffers; tmpbuf = *nxtbuf++; @@ -198,7 +204,7 @@ rcvdistout (FILE *inb, char *form, char *addrs) case FLDPLUS: if ((cptr = wantcomp[CHASH (name)])) do { - if (!strcasecmp (name, cptr->c_name)) { + if (!mh_strcasecmp (name, cptr->c_name)) { char_read += msg_count; if (!cptr->c_text) { cptr->c_text = tmpbuf; @@ -244,7 +250,7 @@ rcvdistout (FILE *inb, char *form, char *addrs) finished: ; i = format_len + char_read + 256; - scanl = malloc ((size_t) i + 2); + scanl = mh_xmalloc ((size_t) i + 2); dat[0] = dat[1] = dat[2] = dat[4] = 0; dat[3] = outputlinelen; fmt_scan (fmt, scanl, i, dat); @@ -264,8 +270,8 @@ finished: ; } -int -done (int status) +static void +unlink_done (int status) { if (backup[0]) unlink (backup); @@ -275,5 +281,4 @@ done (int status) unlink (tmpfil); exit (status ? RCV_MBX : RCV_MOK); - return 1; /* dead code to satisfy the compiler */ }