X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Freplsbr.c;h=8e60a526a3f90a092b03cf8338908152c9cedb5d;hp=add1371d21c972702cc153fa2ab25c15c8045be4;hb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;hpb=337338b404931f06f0db2119c9e145e8ca5a9860 diff --git a/uip/replsbr.c b/uip/replsbr.c index add1371..8e60a52 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -1,10 +1,10 @@ /* - * replsbr.c -- routines to help repl along... - * - * This code is Copyright (c) 2002, by the authors of nmh. See the - * COPYRIGHT file in the root directory of the nmh distribution for - * complete copyright information. - */ +** replsbr.c -- routines to help repl along... +** +** This code is Copyright (c) 2002, by the authors of nmh. See the +** COPYRIGHT file in the root directory of the nmh distribution for +** complete copyright information. +*/ #include #include @@ -26,12 +26,12 @@ static char *dfhost = NULL; static struct mailname mq = { NULL }; /* - * Buffer size for content part of header fields. - * We want this to be large enough so that we don't - * do a lot of extra FLDPLUS calls on m_getfld but - * small enough so that we don't snarf the entire - * message body when we're not going to use any of it. - */ +** Buffer size for content part of header fields. +** We want this to be large enough so that we don't +** do a lot of extra FLDPLUS calls on m_getfld but +** small enough so that we don't snarf the entire +** message body when we're not going to use any of it. +*/ #define SBUFSIZ 256 static struct format *fmt; @@ -59,8 +59,8 @@ static char *addrcomps[] = { }; /* - * static prototypes - */ +** static prototypes +*/ static int insert (struct mailname *); static void replfilter (FILE *, FILE *, char *); @@ -115,8 +115,8 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, } /* - * ignore any components killed by command line switches - */ + ** ignore any components killed by command line switches + */ if (!ccto) { FINDCOMP (cptr, "to"); if (cptr) @@ -142,21 +142,21 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, ismymbox (NULL); /* - * pick any interesting stuff out of msg "inb" - */ + ** pick any interesting stuff out of msg "inb" + */ for (state = FLD;;) { state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb); switch (state) { case FLD: case FLDPLUS: /* - * if we're interested in this component, - * save a pointer to the component text, - * then start using our next free buffer - * as the component temp buffer (buffer - * switching saves an extra copy of the - * component text). - */ + ** if we're interested in this component, + ** save a pointer to the component text, + ** then start using our next free buffer + ** as the component temp buffer (buffer + ** switching saves an extra copy of the + ** component text). + */ if ((cptr = wantcomp[CHASH(name)])) do { if (!mh_strcasecmp(name, cptr->c_name)) { @@ -205,13 +205,13 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, } /* - * format and output the header lines. - */ + ** format and output the header lines. + */ finished: /* - * if there's a "Subject" component, strip any "Re:"s off it - */ + ** if there's a "Subject" component, strip any "Re:"s off it + */ FINDCOMP (cptr, "subject") if (cptr && (cp = cptr->c_text)) { register char *sp = cp; @@ -246,9 +246,9 @@ finished: } /* - * Check if we should filter the message - * or add mhbuild directives - */ + ** Check if we should filter the message + ** or add mhbuild directives + */ if (filter) { fflush(out); if (ferror (out)) @@ -256,8 +256,8 @@ finished: replfilter (inb, out, filter); } else if (mime && mp) { - fprintf (out, "#forw [original message] +%s %s\n", - mp->foldpath, m_name (mp->lowsel)); + fprintf (out, "#forw [original message] +%s %s\n", + mp->foldpath, m_name (mp->lowsel)); } fflush(out); @@ -267,7 +267,8 @@ finished: /* return dynamically allocated buffers */ free (scanl); - for (nxtbuf = compbuffers, i = ncomps; (cptr = *savecomp++); nxtbuf++, i--) + for (nxtbuf = compbuffers, i = ncomps; (cptr = *savecomp++); + nxtbuf++, i--) free (cptr->c_text); /* if not nxtbuf, nxtbuf already freed */ while ( i-- > 0) free (*nxtbuf++); /* free unused nxtbufs */ @@ -285,9 +286,9 @@ static unsigned int bufsiz=0; /* current size of buf */ #define CPY(s) { cp = (s); while ((*dst++ = *cp++)) ; --dst; } /* - * check if there's enough room in buf for str. - * add more mem if needed - */ +** check if there's enough room in buf for str. +** add more mem if needed +*/ #define CHECKMEM(str) \ if ((len = strlen (str)) >= bufend - dst) {\ int i = dst - buf;\ @@ -301,16 +302,16 @@ static unsigned int bufsiz=0; /* current size of buf */ /* - * fmt_scan will call this routine if the user includes the function - * "(formataddr {component})" in a format string. "orig" is the - * original contents of the string register. "str" is the address - * string to be formatted and concatenated onto orig. This routine - * returns a pointer to the concatenated address string. - * - * We try to not do a lot of malloc/copy/free's (which is why we - * don't call "getcpy") but still place no upper limit on the - * length of the result string. - */ +** fmt_scan will call this routine if the user includes the function +** "(formataddr {component})" in a format string. "orig" is the +** original contents of the string register. "str" is the address +** string to be formatted and concatenated onto orig. This routine +** returns a pointer to the concatenated address string. +** +** We try to not do a lot of malloc/copy/free's (which is why we +** don't call "getcpy") but still place no upper limit on the +** length of the result string. +*/ char * formataddr (char *orig, char *str) { @@ -330,9 +331,9 @@ formataddr (char *orig, char *str) bufend = buf + bufsiz; } /* - * If "orig" points to our buffer we can just pick up where we - * left off. Otherwise we have to copy orig into our buffer. - */ + ** If "orig" points to our buffer we can just pick up where we + ** left off. Otherwise we have to copy orig into our buffer. + */ if (orig == buf) dst = last_dst; else if (!orig || !*orig) { @@ -347,7 +348,8 @@ formataddr (char *orig, char *str) /* concatenate all the new addresses onto 'buf' */ for (isgroup = 0; (cp = getname (str)); ) { if ((mp = getm (cp, dfhost, dftype, AD_NAME, error)) == NULL) { - snprintf (baddr, sizeof(baddr), "\t%s -- %s\n", cp, error); + snprintf (baddr, sizeof(baddr), "\t%s -- %s\n", + cp, error); badaddrs = add (baddr, badaddrs); continue; } @@ -392,14 +394,16 @@ insert (struct mailname *np) for (mp = &mq; mp->m_next; mp = mp->m_next) { if (!mh_strcasecmp (np->m_host, mp->m_next->m_host) - && !mh_strcasecmp (np->m_mbox, mp->m_next->m_mbox)) + && !mh_strcasecmp (np->m_mbox, + mp->m_next->m_mbox)) return 0; } if (!ccme && ismymbox (np)) return 0; if (querysw) { - snprintf (buffer, sizeof(buffer), "Reply to %s? ", adrformat (np)); + snprintf (buffer, sizeof(buffer), "Reply to %s? ", + adrformat (np)); if (!gans (buffer, anoyes)) return 0; } @@ -415,10 +419,10 @@ insert (struct mailname *np) /* - * Call the mhlproc - * - * This function expects that argument out has been fflushed by the caller. - */ +** Call the mhlproc +** +** This function expects that argument out has been fflushed by the caller. +*/ static void replfilter (FILE *in, FILE *out, char *filter) @@ -447,7 +451,8 @@ replfilter (FILE *in, FILE *out, char *filter) dup2 (fileno (out), fileno (stdout)); closefds (3); - execlp (mhlproc, mhl, "-form", filter, "-noclear", NULL); + execlp (mhlproc, mhl, "-form", filter, "-noclear", + NULL); errstr = strerror(errno); write(2, "unable to exec ", 15); write(2, mhlproc, strlen(mhlproc));