From: Philipp Takacs Date: Sun, 17 Jan 2016 13:19:11 +0000 (+0100) Subject: pipe mail throu show on repl X-Git-Tag: mmh-0.3~56 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=e9df3f1a429daaca00025e76ce8850d104311ee1 pipe mail throu show on repl now repl works as expected for MIME-messages --- diff --git a/uip/repl.c b/uip/repl.c index f5df9ec..71ae98e 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -740,7 +740,8 @@ insert(struct mailname *np) static void replfilter(FILE *in, FILE *out, char *filter) { - int pid, n; + int pid, pid_show, n; + int mailpipe[2]; char *errstr; if (filter == NULL) @@ -752,12 +753,32 @@ replfilter(FILE *in, FILE *out, char *filter) rewind(in); lseek(fileno(in), (off_t) 0, SEEK_SET); - switch (pid = fork()) { + if (pipe(mailpipe) == -1) { + adios(EX_OSERR, "pipe", "can't create pipe"); + } + + switch (pid_show = fork()) { case NOTOK: adios(EX_OSERR, "fork", "unable to"); case OK: dup2(fileno(in), fileno(stdin)); + dup2(mailpipe[1], fileno(stdout)); + for (n=3; n