* 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 <h/mh.h>
#include <h/signals.h>
+#include <h/utils.h>
#include <signal.h>
static struct swit switches[] = {
char *from = NULL, *body = NULL, **argp, **arguments;
char *vec[5], buf[BUFSIZ];
FILE *out;
+ char *tfile = NULL;
#ifdef LOCALE
setlocale(LC_ALL, "");
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);
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))) {