X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Freplsbr.c;h=a6d0f233b54e455a577731596991b199c37ad620;hb=015e83362f21a061bf268b878693d72309c21e55;hp=e2f63c578a8676e116b2b6a955556b3c334bfa45;hpb=88b27ae07f694e90637c2a852b754539c2f70172;p=mmh diff --git a/uip/replsbr.c b/uip/replsbr.c index e2f63c5..a6d0f23 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -64,15 +64,13 @@ static char *addrcomps[] = { * static prototypes */ static int insert (struct mailname *); -static void replfilter (FILE *, FILE *, char *); +static void replfilter (FILE *, FILE *, char *, int); void replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, - int mime, char *form, char *filter, char *fcc) + int mime, char *form, char *filter, char *fcc, int fmtproc) { - NMH_UNUSED (msg); - register int state, i; register struct comp *cptr; register char *tmpbuf; @@ -83,6 +81,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, char name[NAMESZ], *scanl; unsigned char *cp; FILE *out; + NMH_UNUSED (msg); mask = umask(~m_gmprot()); if ((out = fopen (drft, "w")) == NULL) @@ -164,9 +163,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, if (!mh_strcasecmp(name, cptr->c_name)) { char_read += msg_count; if (! cptr->c_text) { - i = strlen(cptr->c_text = tmpbuf) - 1; - if (tmpbuf[i] == '\n') - tmpbuf[i] = '\0'; + cptr->c_text = tmpbuf; *--savecomp = cptr; tmpbuf = *nxtbuf++; } else { @@ -256,7 +253,7 @@ finished: if (ferror (out)) adios (drft, "error writing"); - replfilter (inb, out, filter); + replfilter (inb, out, filter, fmtproc); } else if (mime && mp) { fprintf (out, "#forw [original message] +%s %s\n", mp->foldpath, m_name (mp->lowsel)); @@ -433,11 +430,6 @@ insert (struct mailname *np) } mp->m_next = np; -#ifdef ISI - if (ismymbox (np)) - ccme = 0; -#endif - return 1; } @@ -449,11 +441,12 @@ insert (struct mailname *np) */ static void -replfilter (FILE *in, FILE *out, char *filter) +replfilter (FILE *in, FILE *out, char *filter, int fmtproc) { int pid; char *mhl; char *errstr; + char *arglist[7]; if (filter == NULL) return; @@ -475,7 +468,26 @@ replfilter (FILE *in, FILE *out, char *filter) dup2 (fileno (out), fileno (stdout)); closefds (3); - execlp (mhlproc, mhl, "-form", filter, "-noclear", NULL); + arglist[0] = mhl; + arglist[1] = "-form"; + arglist[2] = filter; + arglist[3] = "-noclear"; + + switch (fmtproc) { + case 1: + arglist[4] = "-fmtproc"; + arglist[5] = formatproc; + arglist[6] = NULL; + break; + case 0: + arglist[4] = "-nofmtproc"; + arglist[5] = NULL; + break; + default: + arglist[4] = NULL; + } + + execvp (mhlproc, arglist); errstr = strerror(errno); write(2, "unable to exec ", 15); write(2, mhlproc, strlen(mhlproc));