]> diplodocus.org Git - nmh/blobdiff - uip/whatnowsbr.c
Added support for "-" to indicate stdout to output_message().
[nmh] / uip / whatnowsbr.c
index 57d72825465cd9e88dfe2d01d915d3abda59e0bd..90a2cf2e26cf3b1c3b7f2f22e573cd9d2ce10a35 100644 (file)
@@ -644,7 +644,7 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
 {
     int pid, status, vecp;
     char altpath[BUFSIZ], linkpath[BUFSIZ];
-    char *cp, *vec[MAXARGS];
+    char *cp, *prog, **vec;
     struct stat st;
 
 #ifdef HAVE_LSTAT
@@ -697,7 +697,7 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
     context_save ();   /* save the context file */
     fflush (stdout);
 
-    switch (pid = vfork()) {
+    switch (pid = fork()) {
        case NOTOK:
            advise ("fork", "unable to");
            status = NOTOK;
@@ -712,15 +712,15 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
                m_putenv ("editalt", altpath);
            }
 
-           vecp = 0;
-           vec[vecp++] = r1bindex (*ed, '/');
+           vec = argsplit(*ed, &prog, &vecp);
+
            if (arg)
                while (*arg)
                    vec[vecp++] = *arg++;
            vec[vecp++] = file;
            vec[vecp] = NULL;
 
-           execvp (*ed, vec);
+           execvp (prog, vec);
            fprintf (stderr, "unable to exec ");
            perror (*ed);
            _exit (-1);
@@ -845,7 +845,7 @@ sendfile (char **arg, char *file, int pushsw)
     context_save ();   /* save the context file */
     fflush (stdout);
 
-    for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+    for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
        sleep (5);
     switch (child_id) {
        case NOTOK:
@@ -940,6 +940,7 @@ check_draft (char *msgnam)
                 */
                if (uprf (name, XXX_FIELD_PRF)) {
                    fclose (fp);
+                   m_getfld_state_destroy (&gstate);
                    return 0;
                }
                while (state == FLDPLUS) {
@@ -955,6 +956,7 @@ check_draft (char *msgnam)
                    for (bp = buf; *bp; bp++)
                        if (*bp != ' ' && *bp != '\t' && *bp != '\n') {
                            fclose (fp);
+                           m_getfld_state_destroy (&gstate);
                            return 1;
                        }
 
@@ -965,10 +967,10 @@ check_draft (char *msgnam)
 
            default:
                fclose (fp);
+               m_getfld_state_destroy (&gstate);
                return 0;
        }
     }
-    m_getfld_state_destroy (&gstate);
 }
 
 
@@ -1331,7 +1333,7 @@ whomfile (char **arg, char *file)
     context_save ();   /* save the context file */
     fflush (stdout);
 
-    switch (pid = vfork()) {
+    switch (pid = fork()) {
        case NOTOK:
            advise ("fork", "unable to");
            return 1;