0
|
1 /* refile.c - refile the draft into another folder */
|
|
2 #ifndef lint
|
|
3 static char ident[] = "@(#)$Id$";
|
|
4 #endif /* lint */
|
|
5
|
|
6 #include "../h/mh.h"
|
|
7 #include <stdio.h>
|
|
8 #ifdef UNISTD
|
|
9 #include <unistd.h>
|
|
10 #endif
|
|
11
|
|
12 int refile (arg, file)
|
|
13 register char **arg,
|
|
14 *file;
|
|
15 {
|
|
16 int pid;
|
|
17 register int vecp;
|
|
18 char *vec[MAXARGS];
|
|
19
|
|
20 vecp = 0;
|
|
21 vec[vecp++] = r1bindex (fileproc, '/');
|
|
22 vec[vecp++] = "-nolink"; /* override bad .mh_profile defaults */
|
|
23 vec[vecp++] = "-nopreserve";
|
|
24 vec[vecp++] = "-file";
|
|
25 vec[vecp++] = file;
|
|
26
|
|
27 if (arg)
|
|
28 while (*arg)
|
|
29 vec[vecp++] = *arg++;
|
|
30 vec[vecp] = NULL;
|
|
31
|
|
32 m_update ();
|
|
33 (void) fflush (stdout);
|
|
34
|
|
35 switch (pid = vfork ()) {
|
|
36 case NOTOK:
|
|
37 advise ("fork", "unable to");
|
|
38 return NOTOK;
|
|
39
|
|
40 case OK:
|
|
41 execvp (fileproc, vec);
|
|
42 fprintf (stderr, "unable to exec ");
|
|
43 perror (fileproc);
|
|
44 _exit (-1);
|
|
45
|
|
46 default:
|
|
47 return (pidwait (pid, NOTOK));
|
|
48 }
|
|
49 }
|