]>
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.
14 refile (char **arg
, char *file
)
21 vec
= argsplit(fileproc
, &program
, &vecp
);
23 vec
[vecp
++] = mh_xstrdup("-nolink"); /* override bad .mh_profile defaults */
24 vec
[vecp
++] = mh_xstrdup("-nopreserve");
25 vec
[vecp
++] = mh_xstrdup("-file");
26 vec
[vecp
++] = getcpy(file
);
30 vec
[vecp
++] = mh_xstrdup(*arg
++);
34 context_save(); /* save the context file */
37 switch (pid
= fork()) {
39 advise ("fork", "unable to");
43 execvp (program
, vec
);
44 fprintf (stderr
, "unable to exec ");
49 arglist_free(program
, vec
);
50 return (pidwait (pid
, -1));