X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhmail.c;h=e5868609584aea49e60068d837bb5d189f77fb0d;hp=f9dc33bf0ab053d18709c64cedec4507b15cfd23;hb=5dd6771b28c257af405d7248639ed0e3bcdce38b;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b diff --git a/uip/mhmail.c b/uip/mhmail.c index f9dc33b..e586860 100644 --- a/uip/mhmail.c +++ b/uip/mhmail.c @@ -2,11 +2,14 @@ /* * mhmail.c -- simple mail program * - * $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 static struct swit switches[] = { @@ -21,7 +24,7 @@ static struct swit switches[] = { #define VERSIONSW 4 { "version", 0 }, #define HELPSW 5 - { "help", 4 }, + { "help", 0 }, #define RESNDSW 6 { "resent", -6 }, #define QUEUESW 7 @@ -47,6 +50,7 @@ main (int argc, char **argv) char *from = NULL, *body = NULL, **argp, **arguments; char *vec[5], buf[BUFSIZ]; FILE *out; + char *tfile = NULL; #ifdef LOCALE setlocale(LC_ALL, ""); @@ -120,10 +124,11 @@ main (int argc, char **argv) if (tolist == NULL) adios (NULL, "usage: %s addrs ... [switches]", invo_name); - strncpy (tmpfil, m_tmpfil (invo_name), sizeof(tmpfil)); - if ((out = fopen (tmpfil, "w")) == NULL) - adios (tmpfil, "unable to write"); - chmod (tmpfil, 0600); + + tfile = m_mktemp2(NULL, invo_name, NULL, &out); + if (tfile == NULL) adios("mhmail", "unable to create temporary file"); + chmod(tfile, 0600); + strncpy (tmpfil, tfile, sizeof(tmpfil)); SIGNAL2 (SIGINT, intrser); @@ -168,7 +173,7 @@ main (int argc, char **argv) if (child_id == NOTOK) { /* report failure and then send it */ - admonish (NULL, "unable to fork"); + adios (NULL, "unable to fork"); } else if (child_id) { /* parent process */ if ((status = pidXwait(child_id, postproc))) { @@ -187,6 +192,8 @@ main (int argc, char **argv) perror (postproc); _exit (-1); } + + return 0; /* dead code to satisfy the compiler */ }