Revision 12455,
921 bytes
checked in by danw, 26 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r12454,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | |
---|
2 | /* |
---|
3 | * refile.c -- call the "fileproc" to refile the |
---|
4 | * -- msg or draft into another folder |
---|
5 | * |
---|
6 | * $Id: refile.c,v 1.1.1.1 1999-02-07 18:14:09 danw Exp $ |
---|
7 | */ |
---|
8 | |
---|
9 | #include <h/mh.h> |
---|
10 | |
---|
11 | |
---|
12 | int |
---|
13 | refile (char **arg, char *file) |
---|
14 | { |
---|
15 | pid_t pid; |
---|
16 | register int vecp; |
---|
17 | char *vec[MAXARGS]; |
---|
18 | |
---|
19 | vecp = 0; |
---|
20 | vec[vecp++] = r1bindex (fileproc, '/'); |
---|
21 | vec[vecp++] = "-nolink"; /* override bad .mh_profile defaults */ |
---|
22 | vec[vecp++] = "-nopreserve"; |
---|
23 | vec[vecp++] = "-file"; |
---|
24 | vec[vecp++] = file; |
---|
25 | |
---|
26 | if (arg) { |
---|
27 | while (*arg) |
---|
28 | vec[vecp++] = *arg++; |
---|
29 | } |
---|
30 | vec[vecp] = NULL; |
---|
31 | |
---|
32 | context_save(); /* save the context file */ |
---|
33 | fflush(stdout); |
---|
34 | |
---|
35 | switch (pid = vfork()) { |
---|
36 | case -1: |
---|
37 | advise ("fork", "unable to"); |
---|
38 | return -1; |
---|
39 | |
---|
40 | case 0: |
---|
41 | execvp (fileproc, vec); |
---|
42 | fprintf (stderr, "unable to exec "); |
---|
43 | perror (fileproc); |
---|
44 | _exit (-1); |
---|
45 | |
---|
46 | default: |
---|
47 | return (pidwait (pid, -1)); |
---|
48 | } |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.