X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Frcvdist.c;h=8ff0365bd6b904fbccfbad319ed7d28d7912bbf5;hb=363d8b056113f4a54e84149977eac95505e38d59;hp=1667232c8a22436dcb9233a69f37a5ef1deda092;hpb=56a805299de35d8924969138aef4d0f1580daa6d;p=mmh diff --git a/uip/rcvdist.c b/uip/rcvdist.c index 1667232..8ff0365 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -2,8 +2,6 @@ /* * 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. @@ -34,7 +32,7 @@ static char tmpfil[BUFSIZ] = ""; * prototypes */ static void rcvdistout (FILE *, char *, char *); -static int unlink_done (int); +static void unlink_done (int) NORETURN; int @@ -44,7 +42,8 @@ main (int argc, char **argv) int i, vecp = 1; char *addrs = NULL, *cp, *form = NULL, buf[BUFSIZ]; char **argp, **arguments, *vec[MAXARGS]; - register FILE *fp; + FILE *fp; + char *tfile = NULL; done=unlink_done; @@ -75,10 +74,10 @@ main (int argc, char **argv) "%s [switches] [switches for postproc] address ...", invo_name); print_help (buf, switches, 1); - done (1); + done (0); case VERSIONSW: print_version(invo_name); - done (1); + done (0); case FORMSW: if (!(form = *argp++) || *form == '-') @@ -94,12 +93,18 @@ main (int argc, char **argv) invo_name); umask (~m_gmprot ()); - strncpy (tmpfil, m_tmpfil (invo_name), sizeof(tmpfil)); - if ((fp = fopen (tmpfil, "w+")) == NULL) - adios (tmpfil, "unable to create"); + + tfile = m_mktemp2(NULL, invo_name, NULL, &fp); + if (tfile == NULL) adios("rcvdist", "unable to create temporary file"); + strncpy (tmpfil, tfile, sizeof(tmpfil)); + cpydata (fileno (stdin), fileno (fp), "message", tmpfil); fseek (fp, 0L, SEEK_SET); - strncpy (drft, m_tmpfil (invo_name), sizeof(drft)); + + tfile = m_mktemp2(NULL, invo_name, NULL, NULL); + if (tfile == NULL) adios("forw", "unable to create temporary file"); + strncpy (drft, tfile, sizeof(tmpfil)); + rcvdistout (fp, form, addrs); fclose (fp); @@ -109,6 +114,10 @@ main (int argc, char **argv) vec[0] = r1bindex (postproc, '/'); vec[vecp++] = "-dist"; vec[vecp++] = drft; + if ((cp = context_find ("mhlproc"))) { + vec[vecp++] = "-mhlproc"; + vec[vecp++] = cp; + } vec[vecp] = NULL; for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) @@ -270,7 +279,7 @@ finished: ; } -static int +static void unlink_done (int status) { if (backup[0]) @@ -281,5 +290,4 @@ unlink_done (int status) unlink (tmpfil); exit (status ? RCV_MBX : RCV_MOK); - return 1; /* dead code to satisfy the compiler */ }