]> diplodocus.org Git - nmh/blobdiff - uip/dist.c
Bump up size of two static char[] so gcc knows they won't overflow.
[nmh] / uip / dist.c
index 3d247181b5c9c50f03faefc9ef7f6a768407f461..19158bad2f32cf226f7b032d323e6610b0e4cbc1 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * dist.c -- re-distribute a message
+/* dist.c -- re-distribute a message
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -9,6 +7,7 @@
 
 #include <h/mh.h>
 #include <h/utils.h>
+#include "../sbr/m_maildir.h"
 #include <fcntl.h>
 
 #define DIST_SWITCHES \
@@ -83,13 +82,7 @@ main (int argc, char **argv)
     struct msgs *mp = NULL;
     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;
@@ -224,7 +217,7 @@ main (int argc, char **argv)
        }
     }
 
-    cwd = getcpy (pwd ());
+    cwd = mh_xstrdup(pwd ());
 
     if (!context_find ("path"))
        free (path ("./", TFOLDER));
@@ -238,7 +231,8 @@ try_it_again:
     if (stat (drft, &st) != NOTOK) {
        printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size);
        for (i = LISTDSW; i != YESW;) {
-           if (!(argp = getans ("\nDisposition? ", isdf ? aqrnl : aqrl)))
+           if (!(argp = read_switch_multiword ("\nDisposition? ",
+                                               isdf ? aqrnl : aqrl)))
                done (1);
            switch (i = smatch (*argp, isdf ? aqrnl : aqrl)) {
                case NOSW: 
@@ -256,7 +250,7 @@ try_it_again:
                        i = YESW;
                    break;
                default: 
-                   advise (NULL, "say what?");
+                   inform("say what?");
                    break;
            }
        }
@@ -281,7 +275,7 @@ try_it_again:
            adios (maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
+       if (!(mp = folder_read (folder, 1)))
            adios (NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
@@ -297,7 +291,7 @@ try_it_again:
            adios (NULL, "only one message at a time!");
     }
 
-    msgnam = file ? file : getcpy (m_name (mp->lowsel));
+    msgnam = file ? file : mh_xstrdup(m_name (mp->lowsel));
 
     dat[0] = mp ? mp->lowsel : 0;
     dat[1] = 0;