X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fwhatnow.c;h=0576ff84add95b4ca02d6e68690747f5bd2b05aa;hp=6e58052b88991053cdb94eaa557ce1a98a55b1ab;hb=412b2e54251ff6e20537f83b95c8ee76ea8c5c40;hpb=5f6cb9c6ca7a84cbb7b7e3fd4d033af99caa9e18 diff --git a/uip/whatnow.c b/uip/whatnow.c index 6e58052..0576ff8 100644 --- a/uip/whatnow.c +++ b/uip/whatnow.c @@ -99,6 +99,7 @@ static char *myprompt = "\nWhat now? "; static int editfile(char **, char **, char *, int, struct msgs *, char *, char *, int); static int sendfile(char **, char *, int); +static int refile(char **, char *); static int removefile(char *); static void writelscmd(char *, int, char **); static void writesomecmd(char *buf, int bufsz, char *cmd, char *trailcmd, char **argp); @@ -265,8 +266,9 @@ main(int argc, char **argv) case REFILEOPT: /* Refile the draft */ - if (refile(++argp, drft) == 0) + if (refile(++argp, drft) == 0) { done(0); + } break; case CDCMDSW: @@ -788,6 +790,47 @@ sendfile(char **arg, char *file, int pushsw) /* +** refile msg into another folder +*/ +static int +refile(char **arg, char *file) +{ + pid_t pid; + register int vecp; + char *vec[MAXARGS]; + + vecp = 0; + vec[vecp++] = "refile"; + vec[vecp++] = "-nolink"; /* override bad .mh_profile defaults */ + vec[vecp++] = "-file"; + vec[vecp++] = file; + + while (arg && *arg) { + vec[vecp++] = *arg++; + } + vec[vecp] = NULL; + + context_save(); /* save the context file */ + fflush(stdout); + + switch (pid = fork()) { + case -1: + advise("fork", "unable to"); + return -1; + + case 0: + execvp(*vec, vec); + fprintf(stderr, "unable to exec "); + perror(*vec); + _exit(-1); + + default: + return (pidwait(pid, -1)); + } +} + + +/* ** Remove the draft file */