/*
- * 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 <h/mh.h>
#include <h/addrsbr.h>
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;
};
/*
- * static prototypes
- */
+** static prototypes
+*/
static int insert (struct mailname *);
static void replfilter (FILE *, FILE *, char *);
}
/*
- * ignore any components killed by command line switches
- */
+ ** ignore any components killed by command line switches
+ */
if (!ccto) {
FINDCOMP (cptr, "to");
if (cptr)
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)) {
}
/*
- * 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;
}
/*
- * 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))
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);
/* 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 */
#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;\
/*
- * 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)
{
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) {
/* 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;
}
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;
}
/*
- * 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)
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));