Relayouted all switch statements: case aligns with switch.
[mmh] / sbr / refile.c
1 /*
2 ** refile.c -- call the "fileproc" to refile the
3 **          -- msg or draft into another folder
4 **
5 ** This code is Copyright (c) 2002, by the authors of nmh.  See the
6 ** COPYRIGHT file in the root directory of the nmh distribution for
7 ** complete copyright information.
8 */
9
10 #include <h/mh.h>
11
12
13 int
14 refile(char **arg, char *file)
15 {
16         pid_t pid;
17         register int vecp;
18         char *vec[MAXARGS];
19
20         vecp = 0;
21         vec[vecp++] = mhbasename(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         }
31         vec[vecp] = NULL;
32
33         context_save();  /* save the context file */
34         fflush(stdout);
35
36         switch (pid = vfork()) {
37         case -1:
38                 advise("fork", "unable to");
39                 return -1;
40
41         case 0:
42                 execvp(fileproc, vec);
43                 fprintf(stderr, "unable to exec ");
44                 perror(fileproc);
45                 _exit(-1);
46
47         default:
48                 return (pidwait(pid, -1));
49         }
50 }