]> diplodocus.org Git - nmh/blobdiff - uip/forw.c
Use a dynamically-allocated buffer for character set conversion, and
[nmh] / uip / forw.c
index 97714dc412f2d3caa7afc7a5d12f9b0f9d00eac2..2139d35cffa5a8c5c1bbf17fe253f64ef4ca8d42 100644 (file)
@@ -116,16 +116,9 @@ main (int argc, char **argv)
     char **argp, **arguments;
     struct stat st;
     struct msgs_array msgs = { 0, 0, NULL };
     char **argp, **arguments;
     struct stat st;
     struct msgs_array msgs = { 0, 0, NULL };
-
     int buildsw = 0;
 
     int buildsw = 0;
 
-#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;
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -363,7 +356,7 @@ try_it_again:
            adios (maildir, "unable to change directory to");
 
        /* read folder and create message structure */
            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 */
            adios (NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
@@ -496,12 +489,13 @@ mhl_draft (int out, char *digest, int volume, int issue,
     int i, msgnum, pd[2];
     char buf1[BUFSIZ];
     char buf2[BUFSIZ];
     int i, msgnum, pd[2];
     char buf1[BUFSIZ];
     char buf2[BUFSIZ];
+    char *program;
     struct msgs_array vec = { 0, 0, NULL };
 
     if (pipe (pd) == NOTOK)
        adios ("pipe", "unable to create");
 
     struct msgs_array vec = { 0, 0, NULL };
 
     if (pipe (pd) == NOTOK)
        adios ("pipe", "unable to create");
 
-    app_msgarg(&vec, r1bindex (mhlproc, '/'));
+    argsplit_msgarg(&vec, mhlproc, &program);
 
     for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
        sleep (5);
 
     for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
        sleep (5);
@@ -548,7 +542,7 @@ mhl_draft (int out, char *digest, int volume, int issue,
 
            app_msgarg(&vec, NULL);
 
 
            app_msgarg(&vec, NULL);
 
-           execvp (mhlproc, vec.msgs);
+           execvp (program, vec.msgs);
            fprintf (stderr, "unable to exec ");
            perror (mhlproc);
            _exit (-1);
            fprintf (stderr, "unable to exec ");
            perror (mhlproc);
            _exit (-1);