X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/49c748c77f3c9b9ea024c4eb5d1d83855d7e7201..a514b8a78c447c8abc69386bee9f2c463b1c9362:/uip/rcvdist.c diff --git a/uip/rcvdist.c b/uip/rcvdist.c index 3c017c4a..85baf33d 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -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); }