X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Freplsbr.c;h=613b3d9d7326685537c19d4b435d25823c16807a;hb=59b086daa57105e8fbd8b1e6ba60be6a845faf95;hp=244fdc93246620c086c9561e3426857d03e5f3f6;hpb=008837e090c008e3afe7a9c8667070bafa091e62;p=mmh diff --git a/uip/replsbr.c b/uip/replsbr.c index 244fdc9..613b3d9 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -2,8 +2,6 @@ /* * replsbr.c -- routines to help repl along... * - * $Id$ - * * 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. @@ -26,7 +24,8 @@ static int dftype=0; static char *badaddrs = NULL; static char *dfhost = NULL; -static struct mailname mq = { NULL }; +static struct mailname mq; +static int nodupcheck = 0; /* If set, no check for duplicates */ /* * Buffer size for content part of header fields. @@ -72,6 +71,8 @@ void replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, int mime, char *form, char *filter, char *fcc) { + NMH_UNUSED (msg); + register int state, i; register struct comp *cptr; register char *tmpbuf; @@ -79,7 +80,8 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, register char **ap; register struct comp **savecomp; int char_read = 0, format_len, mask; - char name[NAMESZ], *scanl, *cp; + char name[NAMESZ], *scanl; + unsigned char *cp; FILE *out; mask = umask(~m_gmprot()); @@ -159,7 +161,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, */ if ((cptr = wantcomp[CHASH(name)])) do { - if (!strcasecmp(name, cptr->c_name)) { + if (!mh_strcasecmp(name, cptr->c_name)) { char_read += msg_count; if (! cptr->c_text) { cptr->c_text = tmpbuf; @@ -379,18 +381,44 @@ formataddr (char *orig, char *str) } +/* + * fmt_scan will call this routine if the user includes the function + * "(concataddr {component})" in a format string. This behaves exactly + * like formataddr, except that it does NOT suppress duplicate addresses + * between calls. + * + * As an implementation detail: I thought about splitting out formataddr() + * into the generic part and duplicate-suppressing part, but the call to + * insert() was buried deep within a couple of loops and I didn't see a + * way to do it easily. So instead we simply set a special flag to stop + * the duplicate check and call formataddr(). + */ +char * +concataddr(char *orig, char *str) +{ + char *cp; + + nodupcheck = 1; + cp = formataddr(orig, str); + nodupcheck = 0; + return cp; +} + static int insert (struct mailname *np) { char buffer[BUFSIZ]; register struct mailname *mp; + if (nodupcheck) + return 1; + if (np->m_mbox == NULL) return 0; for (mp = &mq; mp->m_next; mp = mp->m_next) { - if (!strcasecmp (np->m_host, mp->m_next->m_host) - && !strcasecmp (np->m_mbox, mp->m_next->m_mbox)) + if (!mh_strcasecmp (np->m_host, mp->m_next->m_host) + && !mh_strcasecmp (np->m_mbox, mp->m_next->m_mbox)) return 0; } if (!ccme && ismymbox (np)) @@ -436,7 +464,7 @@ replfilter (FILE *in, FILE *out, char *filter) rewind (in); lseek (fileno(in), (off_t) 0, SEEK_SET); - switch (pid = vfork ()) { + switch (pid = vfork()) { case NOTOK: adios ("fork", "unable to");