- if (ferror(obuf))
- return(-1);
- if (ishead && (mailp->m_flag & MSTATUS))
- printf("failed to fix up status field\n");
- return(lc);
-}
-
-/*
- * Test if the passed line is a header line, RFC 733 style.
- */
-headerp(line)
- register char *line;
-{
- register char *cp = line;
-
- while (*cp && !isspace(*cp) && *cp != ':')
- cp++;
- while (*cp && isspace(*cp))
- cp++;
- return(*cp == ':');
+ /*
+ * Copy out message body
+ */
+ if (doign == ignoreall)
+ count--; /* skip final blank line */
+ if (prefix != NOSTR)
+ while (count > 0) {
+ if (fgets(line, LINESIZE, ibuf) == NULL) {
+ c = 0;
+ break;
+ }
+ count -= c = strlen(line);
+ if (c > 1)
+ fputs(prefix, obuf);
+ (void) fwrite(line, sizeof *line, c, obuf);
+ if (ferror(obuf))
+ return -1;
+ }
+ else
+ while (count > 0) {
+ c = count < LINESIZE ? count : LINESIZE;
+ if ((c = fread(line, sizeof *line, c, ibuf)) <= 0)
+ break;
+ count -= c;
+ if (fwrite(line, sizeof *line, c, obuf) != c)
+ return -1;
+ }
+ if (doign == ignoreall && c > 0 && line[c - 1] != '\n')
+ /* no final blank line */
+ if ((c = getc(ibuf)) != EOF && putc(c, obuf) == EOF)
+ return -1;
+ return 0;