From: markus schnalke Date: Thu, 15 Jan 2015 20:18:03 +0000 (+0100) Subject: whatnow: Use execprog() ... one more time X-Git-Tag: mmh-0.2-RC1~65 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=e40f90484354303f9ff03878f3b15b3c72b215c2;p=mmh whatnow: Use execprog() ... one more time --- diff --git a/uip/whatnow.c b/uip/whatnow.c index 163a02e..4f8d956 100644 --- a/uip/whatnow.c +++ b/uip/whatnow.c @@ -517,9 +517,9 @@ editfile(char **ed, char **arg, char *file, int use) case OK: vecp = 0; vec[vecp++] = mhbasename(*ed); - if (arg) - while (*arg) - vec[vecp++] = *arg++; + while (arg && *arg) { + vec[vecp++] = *arg++; + } vec[vecp++] = file; vec[vecp] = NULL; @@ -590,11 +590,9 @@ sendfile(char **arg, char *file) static int refile(char **arg, char *file) { - pid_t pid; - register int vecp; + int vecp = 0; char *vec[MAXARGS]; - vecp = 0; vec[vecp++] = "refile"; vec[vecp++] = "-nolink"; /* override bad .mh_profile defaults */ vec[vecp++] = "-file"; @@ -605,23 +603,10 @@ refile(char **arg, char *file) } vec[vecp] = NULL; - context_save(); /* save the context file */ + context_save(); fflush(stdout); - switch (pid = fork()) { - case -1: - advise("fork", "unable to"); - return -1; - - case 0: - execvp(*vec, vec); - fprintf(stderr, "%s: unable to exec ", invo_name); - perror(*vec); - _exit(-1); - - default: - return (pidwait(pid, -1)); - } + return execprog(*vec, vec); }