X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/3b6170b27ba8fedbb4d67d2842bfaa38d4417962..0b7286788a95dd854d1826b8493eda431d8e8aac:/uip/rcvdist.c diff --git a/uip/rcvdist.c b/uip/rcvdist.c index a75e21ac..6f6f5559 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -5,12 +5,20 @@ * complete copyright information. */ -#include -#include -#include -#include -#include -#include +#include "h/mh.h" +#include "sbr/context_find.h" +#include "sbr/ambigsw.h" +#include "sbr/pidstatus.h" +#include "sbr/print_version.h" +#include "sbr/print_help.h" +#include "sbr/arglist.h" +#include "sbr/error.h" +#include "h/fmt_scan.h" +#include "h/rcvmail.h" +#include "h/tws.h" +#include "h/mts.h" +#include "h/done.h" +#include "h/utils.h" #include "sbr/m_mktemp.h" #define RCVDIST_SWITCHES \ @@ -47,9 +55,9 @@ main (int argc, char **argv) FILE *fp; char *tfile = NULL; - if (nmh_init(argv[0], 2)) { return 1; } + if (nmh_init(argv[0], true, false)) { return 1; } - done=unlink_done; + set_done(unlink_done); /* * Configure this now, since any unknown switches to rcvdist get @@ -84,7 +92,7 @@ main (int argc, char **argv) case FORMSW: if (!(form = *argp++) || *form == '-') - adios (NULL, "missing argument to %s", argp[-2]); + die("missing argument to %s", argp[-2]); continue; } } @@ -92,13 +100,13 @@ main (int argc, char **argv) } if (addrs == NULL) - adios (NULL, "usage: %s [switches] [switches for postproc] address ...", + die("usage: %s [switches] [switches for postproc] address ...", invo_name); umask (~m_gmprot ()); if ((tfile = m_mktemp2(NULL, invo_name, NULL, &fp)) == NULL) { - adios(NULL, "unable to create temporary file in %s", get_temp_dir()); + die("unable to create temporary file in %s", get_temp_dir()); } strncpy (tmpfil, tfile, sizeof(tmpfil)); @@ -106,7 +114,7 @@ main (int argc, char **argv) fseek (fp, 0L, SEEK_SET); if ((tfile = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) { - adios(NULL, "unable to create temporary file in %s", get_temp_dir()); + die("unable to create temporary file in %s", get_temp_dir()); } strncpy (drft, tfile, sizeof(tmpfil)); @@ -127,8 +135,8 @@ main (int argc, char **argv) child_id = fork(); switch (child_id) { case NOTOK: - inform("unable to fork, continuing..."); - /* FALLTHRU */ + adios("fork", "failed:"); + case OK: execvp (program, vec); fprintf (stderr, "unable to exec "); @@ -226,7 +234,7 @@ rcvdistout (FILE *inb, char *form, char *addrs) goto finished; default: - adios (NULL, "m_getfld2() returned %d", state); + die("m_getfld2() returned %d", state); } } finished: ;