x <<= bitcount;
if (compsize < origsize) {
if (fwrite(&subbitbuf, 1, 1, outfile) == 0) {
- /* fileerror(WTERR, outfile); */
- fatal_error("Write error in crcio.c(putcode)\n");
- /* exit(errno); */
+ fatal_error("Write error in crcio.c(putcode)");
}
compsize++;
}
x <<= bitcount;
if (compsize < origsize) {
if (fwrite(&subbitbuf, 1, 1, outfile) == 0) {
- /* fileerror(WTERR, outfile); */
- fatal_error("Write error in crcio.c(putbits)\n");
- /* exit(errno); */
+ fatal_error("Write error in crcio.c(putbits)");
}
compsize++;
}
if (fp) {
if (text_mode) {
if (fwrite_txt(p, n, fp))
- fatal_error("File write error\n");
+ fatal_error("File write error");
}
else {
if (fwrite(p, 1, n, fp) < n)
- fatal_error("File write error\n");
+ fatal_error("File write error");
}
}
}
/* ------------------------------------------------------------------------ */
#ifdef EUC
-void
+int
putc_euc(c, fd)
int c;
FILE *fd;
if (putc_euc_cache == EOF) {
if (!euc_mode || c < 0x81 || c > 0xFC) {
- putc(c, fd);
- return;
+ return putc(c, fd);
}
if (c >= 0xA0 && c < 0xE0) {
- putc(0x8E, fd); /* single shift */
- putc(c, fd);
- return;
+ if (putc(0x8E, fd) == EOF) return EOF; /* single shift */
+ return putc(c, fd);
}
putc_euc_cache = c; /* save first byte */
return;
c -= 0x1F;
d = (d - 0x81) * 2 + 0x21;
}
- putc(0x80 | d, fd);
- putc(0x80 | c, fd);
+ if (putc(0x80 | d, fd) == EOF) return EOF;
+ return putc(0x80 | c, fd);
}
#endif
while (--n >= 0) {
if (*p != '\015' && *p != '\032') {
#ifdef EUC
- putc_euc(*p, fp);
+ if (putc_euc(*p, fp) == EOF)
+ break;
#else
- putc(*p, fp);
+ if (putc(*p, fp) == EOF)
+ break;
#endif
}