From e9df3f1a429daaca00025e76ce8850d104311ee1 Mon Sep 17 00:00:00 2001 From: Philipp Takacs Date: Sun, 17 Jan 2016 14:19:11 +0100 Subject: [PATCH] pipe mail throu show on repl now repl works as expected for MIME-messages --- uip/repl.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) 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