#include <h/addrsbr.h>
#include <h/fmt_scan.h>
#include <h/scansbr.h>
-#include <zotnet/tws/tws.h>
+#include <h/tws.h>
#ifdef _FSTDIO
# define _ptr _p /* Gag */
char *scanl = 0; /* text of most recent scanline */
+#define DIEWRERR() adios (scnmsg, "write error on")
+
#define FPUTS(buf) {\
if (mh_fputs(buf,scnout) == EOF)\
- adios (scnmsg, "write error on");\
+ DIEWRERR();\
}
/*
compnum++;
if (outnum) {
FPUTS (name);
- putc (':', scnout);
+ if ( putc (':', scnout) == EOF) DIEWRERR();
FPUTS (tmpbuf);
}
/*
state = FILEEOF; /* stop now if scan cmd */
goto finished;
}
- putc ('\n', scnout);
+ if (putc ('\n', scnout) == EOF) DIEWRERR();
FPUTS (tmpbuf);
/*
* performance hack: some people like to run "inc" on
if (scnout->_cnt <= 0) {
#endif
if (fflush(scnout) == EOF)
- adios (scnmsg, "write error on");
+ DIEWRERR ();
}
#ifdef LINUX_STDIO
state = m_getfld(state, name, scnout->_IO_write_ptr,
if (outnum) {
FPUTS ("\n\nBAD MSG:\n");
FPUTS (name);
- putc ('\n', scnout);
+ if (putc ('\n', scnout) == EOF) DIEWRERR();
state = BODY;
goto body;
}
if (size)
dat[2] = size;
else if (outnum > 0)
+ {
dat[2] = ftell(scnout);
+ if (dat[2] == EOF) DIEWRERR();
+ }
if ((datecomp && !datecomp->c_text) || (!size && !outnum)) {
struct stat st;
*--nxtbuf = tmpbuf;
if (outnum && (ferror(scnout) || fclose (scnout) == EOF))
- adios (scnmsg, "write error on");
+ DIEWRERR();
return (state != FILEEOF ? SCNERR : encrypted ? SCNENC : SCNMSG);
}