FPUTS() exists, but all the putc(3) checks for error were written
alongside in longhand. May as well have a PUTC() to match, though
perhaps just the existing check of the FILE's sticky error state with
ferror(3) is sufficient and neither macro is required.
#define DIEWRERR() adios (scnmsg, "write error on")
+#define PUTC(c) \
+ if (putc((c), scnout) == EOF) \
+ DIEWRERR();
+
#define FPUTS(buf) {\
if (fputs(buf,scnout) == EOF)\
DIEWRERR();\
compnum++;
if (scnout) {
FPUTS (name);
- if ( putc (':', scnout) == EOF) DIEWRERR();
+ PUTC(':');
FPUTS (tmpbuf);
}
/*
goto finished;
}
if (scnout) {
- if (putc ('\n', scnout) == EOF) DIEWRERR();
+ PUTC('\n');
FPUTS (tmpbuf);
}
/*
if (scnout) {
FPUTS ("\n\nBAD MSG:\n");
FPUTS (name);
- if (putc ('\n', scnout) == EOF) DIEWRERR();
+ PUTC('\n');
state = BODY;
goto body;
}