]>
diplodocus.org Git - nmh/blob - sbr/refile.c
1 /* refile.c -- call the "fileproc" to refile the
2 * -- msg or draft into another folder
4 * This code is Copyright (c) 2002, by the authors of nmh. See the
5 * COPYRIGHT file in the root directory of the nmh distribution for
6 * complete copyright information.
12 #include "context_save.h"
19 refile (char **arg
, char *file
)
26 vec
= argsplit(fileproc
, &program
, &vecp
);
28 vec
[vecp
++] = mh_xstrdup("-nolink"); /* override bad .mh_profile defaults */
29 vec
[vecp
++] = mh_xstrdup("-nopreserve");
30 vec
[vecp
++] = mh_xstrdup("-file");
31 vec
[vecp
++] = getcpy(file
);
35 vec
[vecp
++] = mh_xstrdup(*arg
++);
39 context_save(); /* save the context file */
42 switch (pid
= fork()) {
44 advise ("fork", "unable to");
48 execvp (program
, vec
);
49 fprintf (stderr
, "unable to exec ");
54 arglist_free(program
, vec
);
55 return pidwait(pid
, -1);