]> diplodocus.org Git - nmh/blobdiff - uip/rcvdist.c
mhstore(1) now obeys its -noverbose switch.
[nmh] / uip / rcvdist.c
index 3c017c4a36ae489298292892a190199e3103b008..85baf33db00a6a8d9596d820038122f67a8a6266 100644 (file)
@@ -48,15 +48,9 @@ main (int argc, char **argv)
     FILE *fp;
     char *tfile = NULL;
 
-    done=unlink_done;
-
-#ifdef LOCALE
-    setlocale(LC_ALL, "");
-#endif
-    invo_name = r1bindex (argv[0], '/');
+    if (nmh_init(argv[0], 1)) { return 1; }
 
-    /* read user profile/context */
-    context_read();
+    done=unlink_done;
 
     /*
      * Configure this now, since any unknown switches to rcvdist get
@@ -104,15 +98,17 @@ main (int argc, char **argv)
 
     umask (~m_gmprot ());
 
-    tfile = m_mktemp2(NULL, invo_name, NULL, &fp);
-    if (tfile == NULL) adios("rcvdist", "unable to create temporary file");
+    if ((tfile = m_mktemp2(NULL, invo_name, NULL, &fp)) == NULL) {
+       adios(NULL, "unable to create temporary file in %s", get_temp_dir());
+    }
     strncpy (tmpfil, tfile, sizeof(tmpfil));
 
     cpydata (fileno (stdin), fileno (fp), "message", tmpfil);
     fseek (fp, 0L, SEEK_SET);
 
-    tfile = m_mktemp2(NULL, invo_name, NULL, NULL);
-    if (tfile == NULL) adios("forw", "unable to create temporary file");
+    if ((tfile = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) {
+       adios(NULL, "unable to create temporary file in %s", get_temp_dir());
+    }
     strncpy (drft, tfile, sizeof(tmpfil));
 
     rcvdistout (fp, form, addrs);
@@ -241,7 +237,7 @@ finished: ;
     scanl = mh_xmalloc ((size_t) i + 2);
     dat[0] = dat[1] = dat[2] = dat[4] = 0;
     dat[3] = outputlinelen;
-    fmt_scan (fmt, scanl, i + 1, i, dat);
+    fmt_scan (fmt, scanl, i + 1, i, dat, NULL);
     fputs (scanl, out);
 
     if (ferror (out))
@@ -257,11 +253,11 @@ static void
 unlink_done (int status)
 {
     if (backup[0])
-       unlink (backup);
+       (void) m_unlink (backup);
     if (drft[0])
-       unlink (drft);
+       (void) m_unlink (drft);
     if (tmpfil[0])
-       unlink (tmpfil);
+       (void) m_unlink (tmpfil);
 
     exit (status ? RCV_MBX : RCV_MOK);
 }