X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Frefile.c;h=48f0b4441c66907b8e30f748226ffde0ade5733c;hp=fc2793c699dae5ee05836982305ff4f2ed8f1516;hb=5b792c4424571f05bc2008e3109797d18d7d00d1;hpb=5dd6771b28c257af405d7248639ed0e3bcdce38b diff --git a/sbr/refile.c b/sbr/refile.c index fc2793c..48f0b44 100644 --- a/sbr/refile.c +++ b/sbr/refile.c @@ -1,51 +1,50 @@ - /* - * refile.c -- call the "fileproc" to refile the - * -- msg or draft into another folder - * - * This code is Copyright (c) 2002, by the authors of nmh. See the - * COPYRIGHT file in the root directory of the nmh distribution for - * complete copyright information. - */ +** refile.c -- call the "fileproc" to refile the +** -- msg or draft into another folder +** +** This code is Copyright (c) 2002, by the authors of nmh. See the +** COPYRIGHT file in the root directory of the nmh distribution for +** complete copyright information. +*/ #include int -refile (char **arg, char *file) +refile(char **arg, char *file) { - pid_t pid; - register int vecp; - char *vec[MAXARGS]; - - vecp = 0; - vec[vecp++] = r1bindex (fileproc, '/'); - vec[vecp++] = "-nolink"; /* override bad .mh_profile defaults */ - vec[vecp++] = "-nopreserve"; - vec[vecp++] = "-file"; - vec[vecp++] = file; - - if (arg) { - while (*arg) - vec[vecp++] = *arg++; - } - vec[vecp] = NULL; - - context_save(); /* save the context file */ - fflush(stdout); - - switch (pid = vfork()) { - case -1: - advise ("fork", "unable to"); - return -1; - - case 0: - execvp (fileproc, vec); - fprintf (stderr, "unable to exec "); - perror (fileproc); - _exit (-1); - - default: - return (pidwait (pid, -1)); - } + pid_t pid; + register int vecp; + char *vec[MAXARGS]; + + vecp = 0; + vec[vecp++] = mhbasename(fileproc); + vec[vecp++] = "-nolink"; /* override bad .mh_profile defaults */ + vec[vecp++] = "-nopreserve"; + vec[vecp++] = "-file"; + vec[vecp++] = file; + + if (arg) { + while (*arg) + vec[vecp++] = *arg++; + } + vec[vecp] = NULL; + + context_save(); /* save the context file */ + fflush(stdout); + + switch (pid = vfork()) { + case -1: + advise("fork", "unable to"); + return -1; + + case 0: + execvp(fileproc, vec); + fprintf(stderr, "unable to exec "); + perror(fileproc); + _exit(-1); + + default: + return (pidwait(pid, -1)); + } }