- * performance hack: some people like to run "inc" on
- * things like net.sources or large digests. We do a
- * copy directly into the output buffer rather than
- * going through an intermediate buffer.
- *
- * We need the amount of data m_getfld found & don't
- * want to do a strlen on the long buffer so there's
- * a hack in m_getfld to save the amount of data it
- * returned in the global "msg_count".
- */
+ ** Add the Return-Path and Delivery-Date
+ ** header fields to message.
+ */
+ if (get_returnpath(returnpath, sizeof(returnpath),
+ deliverydate, sizeof(deliverydate))) {
+ FPUTS("Return-Path: ");
+ FPUTS(returnpath);
+ FPUTS("Delivery-Date: ");
+ FPUTS(deliverydate);
+ }
+#endif /* RPATHS */
+ }
+
+ /* scan - main loop */
+ for (compnum = 1; ;
+ state = m_getfld(state, name, tmpbuf, rlwidth, inb)) {
+ switch (state) {
+ case FLD:
+ case FLDPLUS:
+ compnum++;
+ if (outnum) {
+ FPUTS(name);
+ if (putc(':', scnout) == EOF)
+ DIEWRERR();
+ FPUTS(tmpbuf);
+ }
+ /*
+ ** 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)) {
+ if (! cptr->c_text) {
+ cptr->c_text = tmpbuf;
+ for (cp = tmpbuf + strlen(tmpbuf) - 1;
+ cp >= tmpbuf; cp--)
+ if (isspace(*cp))
+ *cp = 0;
+ else
+ break;
+ *--savecomp = cptr;
+ tmpbuf = *nxtbuf++;
+ }
+ break;
+ }
+ } while ((cptr = cptr->c_next));
+ }
+
+ while (state == FLDPLUS) {
+ state = m_getfld(state, name, tmpbuf,
+ rlwidth, inb);
+ if (outnum)
+ FPUTS(tmpbuf);
+ }
+ break;
+
+ case BODY:
+ compnum = -1;
+ if (! outnum) {
+ state = FILEEOF; /* stop now if scan cmd */
+ goto finished;
+ }
+ if (putc('\n', scnout) == EOF) DIEWRERR();
+ FPUTS(tmpbuf);
+ /*
+ ** performance hack: some people like to
+ ** run "inc" on things like net.sources or
+ ** large digests. We do a copy directly
+ ** into the output buffer rather than
+ ** going through an intermediate buffer.
+ **
+ ** We need the amount of data m_getfld
+ ** found & don't want to do a strlen on
+ ** the long buffer so there's a hack in
+ ** m_getfld to save the amount of data it
+ ** returned in the global "msg_count".
+ */