the problem another way.
The component parser needs to save the newlines so it can combine
multiple headers properly. So for us, strip out any trailing newlines
when we call fmt_scan().
#define CF_TRUE (1<<0) /* usually means component is present */
#define CF_PARSED (1<<1) /* address/date has been parsed */
#define CF_DATEFAB (1<<2) /* datefield fabricated */
#define CF_TRUE (1<<0) /* usually means component is present */
#define CF_PARSED (1<<1) /* address/date has been parsed */
#define CF_DATEFAB (1<<2) /* datefield fabricated */
+#define CF_TRIMMED (1<<3) /* Component has been trimmed */
case FT_PARSEDATE:
fmt->f_comp->c_flags &= ~CF_PARSED;
break;
case FT_PARSEDATE:
fmt->f_comp->c_flags &= ~CF_PARSED;
break;
+ case FT_COMP:
+ case FT_COMPF:
+ case FT_LS_COMP:
+ case FT_LS_DECODECOMP:
+ /*
+ * Trim these components of any newlines
+ */
+ if (! (fmt->f_comp->c_flags & CF_TRIMMED) &&
+ fmt->f_comp->c_text) {
+ int i = strlen(fmt->f_comp->c_text);
+ if (fmt->f_comp->c_text[i - 1] == '\n')
+ fmt->f_comp->c_text[i - 1] = '\0';
+ fmt->f_comp->c_flags |= CF_TRIMMED;
+ }
+ break;
static char buf[64];
buf[0] = '\0';
static char buf[64];
buf[0] = '\0';
- if (t & ~(CF_TRUE|CF_PARSED|CF_DATEFAB))
+ if (t & ~(CF_TRUE|CF_PARSED|CF_DATEFAB|CF_TRIMMED))
printf(buf, "0x%x ", t);
strcat(buf, "<");
i = 0;
FNORD(CF_TRUE, "TRUE");
FNORD(CF_PARSED, "PARSED");
FNORD(CF_DATEFAB, "DATEFAB");
printf(buf, "0x%x ", t);
strcat(buf, "<");
i = 0;
FNORD(CF_TRUE, "TRUE");
FNORD(CF_PARSED, "PARSED");
FNORD(CF_DATEFAB, "DATEFAB");
+ FNORD(CF_TRIMMED, "TRIMMED");
strcat(buf, ">");
return(buf);
}
strcat(buf, ">");
return(buf);
}
if (!mh_strcasecmp(name, cptr->c_name)) {
char_read += msg_count;
if (! cptr->c_text) {
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';
*--savecomp = cptr;
tmpbuf = *nxtbuf++;
} else {
*--savecomp = cptr;
tmpbuf = *nxtbuf++;
} else {