projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Further clarified Kimmo's etc/Makefile.in comments at his suggestion.
[mmh]
/
uip
/
scansbr.c
diff --git
a/uip/scansbr.c
b/uip/scansbr.c
index
44cbf0d
..
6fd4bb3
100644
(file)
--- a/
uip/scansbr.c
+++ b/
uip/scansbr.c
@@
-9,7
+9,7
@@
#include <h/addrsbr.h>
#include <h/fmt_scan.h>
#include <h/scansbr.h>
#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 */
#ifdef _FSTDIO
# define _ptr _p /* Gag */
@@
-50,9
+50,11
@@
static int dat[5]; /* aux. data for format routine */
char *scanl = 0; /* text of most recent scanline */
char *scanl = 0; /* text of most recent scanline */
+#define DIEWRERR() adios (scnmsg, "write error on")
+
#define FPUTS(buf) {\
if (mh_fputs(buf,scnout) == EOF)\
#define FPUTS(buf) {\
if (mh_fputs(buf,scnout) == EOF)\
- adios (scnmsg, "write error on");\
+ DIEWRERR();\
}
/*
}
/*
@@
-187,7
+189,7
@@
scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
compnum++;
if (outnum) {
FPUTS (name);
compnum++;
if (outnum) {
FPUTS (name);
- putc (':', scnout);
+ if ( putc (':', scnout) == EOF) DIEWRERR();
FPUTS (tmpbuf);
}
/*
FPUTS (tmpbuf);
}
/*
@@
-228,7
+230,7
@@
scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
state = FILEEOF; /* stop now if scan cmd */
goto finished;
}
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
FPUTS (tmpbuf);
/*
* performance hack: some people like to run "inc" on
@@
-249,7
+251,7
@@
body:;
if (scnout->_cnt <= 0) {
#endif
if (fflush(scnout) == EOF)
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,
}
#ifdef LINUX_STDIO
state = m_getfld(state, name, scnout->_IO_write_ptr,
@@
-274,7
+276,7
@@
body:;
if (outnum) {
FPUTS ("\n\nBAD MSG:\n");
FPUTS (name);
if (outnum) {
FPUTS ("\n\nBAD MSG:\n");
FPUTS (name);
- putc ('\n', scnout);
+ if (putc ('\n', scnout) == EOF) DIEWRERR();
state = BODY;
goto body;
}
state = BODY;
goto body;
}
@@
-306,7
+308,10
@@
finished:
if (size)
dat[2] = size;
else if (outnum > 0)
if (size)
dat[2] = size;
else if (outnum > 0)
+ {
dat[2] = ftell(scnout);
dat[2] = ftell(scnout);
+ if (dat[2] == EOF) DIEWRERR();
+ }
if ((datecomp && !datecomp->c_text) || (!size && !outnum)) {
struct stat st;
if ((datecomp && !datecomp->c_text) || (!size && !outnum)) {
struct stat st;
@@
-353,8
+358,8
@@
finished:
}
*--nxtbuf = tmpbuf;
}
*--nxtbuf = tmpbuf;
- if (outnum && fclose (scnout) == EOF)
- adios (scnmsg, "write error on");
+ if (outnum && (ferror(scnout) || fclose (scnout) == EOF))
+ DIEWRERR();
return (state != FILEEOF ? SCNERR : encrypted ? SCNENC : SCNMSG);
}
return (state != FILEEOF ? SCNERR : encrypted ? SCNENC : SCNMSG);
}