]> diplodocus.org Git - nmh/blob - sbr/refile.c
Cope with sasl_decode64() returning SASL_CONTINUE as well as SASL_OK.
[nmh] / sbr / refile.c
1
2 /*
3 * refile.c -- call the "fileproc" to refile the
4 * -- msg or draft into another folder
5 *
6 * $Id$
7 *
8 * This code is Copyright (c) 2002, by the authors of nmh. See the
9 * COPYRIGHT file in the root directory of the nmh distribution for
10 * complete copyright information.
11 */
12
13 #include <h/mh.h>
14
15
16 int
17 refile (char **arg, char *file)
18 {
19 pid_t pid;
20 register int vecp;
21 char *vec[MAXARGS];
22
23 vecp = 0;
24 vec[vecp++] = r1bindex (fileproc, '/');
25 vec[vecp++] = "-nolink"; /* override bad .mh_profile defaults */
26 vec[vecp++] = "-nopreserve";
27 vec[vecp++] = "-file";
28 vec[vecp++] = file;
29
30 if (arg) {
31 while (*arg)
32 vec[vecp++] = *arg++;
33 }
34 vec[vecp] = NULL;
35
36 context_save(); /* save the context file */
37 fflush(stdout);
38
39 switch (pid = vfork()) {
40 case -1:
41 advise ("fork", "unable to");
42 return -1;
43
44 case 0:
45 execvp (fileproc, vec);
46 fprintf (stderr, "unable to exec ");
47 perror (fileproc);
48 _exit (-1);
49
50 default:
51 return (pidwait (pid, -1));
52 }
53 }