scansbr: Only write to file if we're incing, but not when scanning.
[mmh] / uip / scansbr.c
index dca761c..ca98c5a 100644 (file)
@@ -139,14 +139,10 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg,
                }
        }
 
-       if (ismbox) {
-               if (incing) {
-                       scnmsg = m_name(outnum);
-                       if (*scnmsg == '?')  /* msg num out of range */
-                               return SCNNUM;
-               } else {
-                       scnmsg = "/dev/null";
-               }
+       if (incing) {
+               scnmsg = m_name(outnum);
+               if (*scnmsg == '?')  /* msg num out of range */
+                       return SCNNUM;
                if ((scnout = fopen(scnmsg, "w")) == NULL)
                        adios(scnmsg, "unable to write");
                /*
@@ -211,7 +207,7 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg,
                case BODY:
                        compnum = -1;
                        if (!incing) {
-                               state = FILEEOF; /* stop now if scan cmd */
+                               state = FILEEOF; /* stop here if scan cmd */
                                goto finished;
                        }
                        if (putc('\n', scnout) == EOF)
@@ -334,7 +330,7 @@ finished:
        }
        *--nxtbuf = tmpbuf;
 
-       if (ismbox && (ferror(scnout) || fclose(scnout) == EOF))
+       if (incing && (ferror(scnout) || fclose(scnout) == EOF))
                adios(scnmsg, "write error on");
 
        return (state != FILEEOF ? SCNERR : SCNMSG);