+ while (c > 0L) {
+ fgets(line, LINESIZE, ibuf);
+ c -= (long) strlen(line);
+ lc++;
+ if (ishead) {
+ /*
+ * First line is the From line, so no headers
+ * there to worry about
+ */
+ if (fline) {
+ fline = 0;
+ goto writeit;
+ }
+ /*
+ * If line is blank, we've reached end of
+ * headers, so force out status: field
+ * and note that we are no longer in header
+ * fields
+ */
+ if (line[0] == '\n') {
+ if (dostat) {
+ statusput(mailp, obuf, doign);
+ dostat = 0;
+ }
+ ishead = 0;
+ goto writeit;
+ }
+ /*
+ * If this line is a continuation (via space or tab)
+ * of a previous header field, just echo it
+ * (unless the field should be ignored).
+ */
+ if (infld && (isspace(line[0]) || line[0] == '\t')) {
+ if (doign && isign(field)) continue;
+ goto writeit;
+ }
+ infld = 0;
+ /*
+ * If we are no longer looking at real
+ * header lines, force out status:
+ * This happens in uucp style mail where
+ * there are no headers at all.
+ */
+ if (!headerp(line)) {
+ if (dostat) {
+ statusput(mailp, obuf, doign);
+ dostat = 0;
+ }
+ putc('\n', obuf);
+ ishead = 0;
+ goto writeit;
+ }
+ infld++;
+ /*
+ * Pick up the header field.
+ * If it is an ignored field and
+ * we care about such things, skip it.
+ */
+ cp = line;
+ cp2 = field;
+ while (*cp && *cp != ':' && !isspace(*cp))
+ *cp2++ = *cp++;
+ *cp2 = 0;
+ if (doign && isign(field))
+ continue;
+ /*
+ * If the field is "status," go compute and print the
+ * real Status: field
+ */
+ if (icequal(field, "status")) {
+ if (dostat) {
+ statusput(mailp, obuf, doign);
+ dostat = 0;
+ }
+ continue;
+ }
+ }
+writeit:
+ fputs(line, obuf);