]> diplodocus.org Git - nmh/blobdiff - sbr/refile.c
mhlsbr.c: Don't strchr(3) non-string NUL-less buffer.
[nmh] / sbr / refile.c
index f0fc76e58feb0e8b50a88976b3dca6e14e7d0b41..ade07f6e775415de3542aadf193a921538f71597 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * refile.c -- call the "fileproc" to refile the
+/* refile.c -- call the "fileproc" to refile the
  *          -- msg or draft into another folder
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
@@ -9,6 +7,7 @@
  */
 
 #include <h/mh.h>
+#include <h/utils.h>
 
 
 int
@@ -21,21 +20,21 @@ refile (char **arg, char *file)
 
     vec = argsplit(fileproc, &program, &vecp);
 
-    vec[vecp++] = getcpy("-nolink");   /* override bad .mh_profile defaults */
-    vec[vecp++] = getcpy("-nopreserve");
-    vec[vecp++] = getcpy("-file");
+    vec[vecp++] = mh_xstrdup("-nolink"); /* override bad .mh_profile defaults */
+    vec[vecp++] = mh_xstrdup("-nopreserve");
+    vec[vecp++] = mh_xstrdup("-file");
     vec[vecp++] = getcpy(file);
 
     if (arg) {
        while (*arg)
-           vec[vecp++] = *arg++;
+           vec[vecp++] = mh_xstrdup(*arg++);
     }
     vec[vecp] = NULL;
 
     context_save();    /* save the context file */
     fflush(stdout);
 
-    switch (pid = vfork()) {
+    switch (pid = fork()) {
        case -1: 
            advise ("fork", "unable to");
            return -1;
@@ -48,6 +47,6 @@ refile (char **arg, char *file)
 
        default: 
            arglist_free(program, vec);
-           return (pidwait (pid, -1));
+           return pidwait(pid, -1);
     }
 }