]> diplodocus.org Git - nmh/blobdiff - uip/send.c
Another pass at cleaning up (some of) the manpages.
[nmh] / uip / send.c
index 3ba82fb55b6af676325b18952fe4743888b0b3ed..26ef89a8b4d18997da75416e1cb01f59f78a6722 100644 (file)
@@ -69,6 +69,7 @@
     X("tls", TLSminc(-3), TLSSW) \
     X("initialtls", TLSminc(-10), INITTLSSW) \
     X("notls", TLSminc(-5), NTLSSW) \
+    X("sendmail program", 0, MTSSM) \
     X("mts smtp|sendmail/smtp|sendmail/pipe", 2, MTSSW) \
     X("messageid localname|random", 2, MESSAGEIDSW) \
 
@@ -118,13 +119,7 @@ main (int argc, char **argv)
     struct msgs *mp;
     struct stat st;
 
-#ifdef LOCALE
-    setlocale(LC_ALL, "");
-#endif
-    invo_name = r1bindex (argv[0], '/');
-
-    /* read user profile/context */
-    context_read();
+    if (nmh_init(argv[0], 1)) { return 1; }
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -262,6 +257,7 @@ main (int argc, char **argv)
                case SASLMXSSFSW:
                case USERSW:
                case PORTSW:
+               case MTSSM:
                case MTSSW:
                case MESSAGEIDSW:
                    vec[vecp++] = --cp;
@@ -384,8 +380,12 @@ go_to_it:
            && (distsw = atoi (cp))
            && altmsg) {
        vec[vecp++] = "-dist";
-       distfile = getcpy (m_mktemp2 (altmsg, invo_name, NULL, NULL));
-       unlink(distfile);
+       if ((cp = m_mktemp2(altmsg, invo_name, NULL, NULL)) == NULL) {
+           adios(NULL, "unable to create temporary file in %s",
+                 get_temp_dir());
+       }
+       distfile = getcpy (cp);
+       (void) m_unlink(distfile);
        if (link (altmsg, distfile) == NOTOK) {
            /* Cygwin with FAT32 filesystem produces EPERM. */
            if (errno != EXDEV  &&  errno != EPERM
@@ -395,7 +395,11 @@ go_to_it:
                )
                adios (distfile, "unable to link %s to", altmsg);
            free (distfile);
-           distfile = getcpy (m_mktemp2(NULL, invo_name, NULL, NULL));
+           if ((cp = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) {
+               adios(NULL, "unable to create temporary file in %s",
+                     get_temp_dir());
+           }
+           distfile = getcpy (cp);
            {
                int in, out;
                struct stat st;