-
- /*
- ** Get the first field. If the message is non-empty
- ** and we're doing an "inc", open the output file.
- */
- if ((state = m_getfld(FLD, name, tmpbuf, rlwidth, inb)) == FILEEOF) {
- if (ferror(inb)) {
- advise("read", "unable to"); /* "read error" */
- return SCNFAT;
- } else {
- return SCNEOF;
- }
- }
-
- if (outnum) {
- if (outnum > 0) {
- scnmsg = m_name(outnum);
- if (*scnmsg == '?') /* msg num out of range */
- return SCNNUM;
- } else {
- scnmsg = "/dev/null";
- }
- if ((scnout = fopen(scnmsg, "w")) == NULL)
- adios(scnmsg, "unable to write");
-#ifdef RPATHS
- /*
- ** 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 */
+ fpos = ftell(inb);
+
+ if (incing) {
+ scnmsg = m_name(outnum);
+ if (*scnmsg == '?') /* msg num out of range */
+ return SCNNUM;
+ if (!(scnout = fopen(scnmsg, "w")))
+ adios(EX_IOERR, scnmsg, "unable to write");