From: eck Date: Thu, 21 Jun 1990 11:13:23 +0000 (+0000) Subject: always flush line-buffered output when filling an input buffer X-Git-Tag: release-5-5~1668 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=472ee0cea4bdd1e2bdafe0d1eb8c26de14271b04;p=ack.git always flush line-buffered output when filling an input buffer --- diff --git a/lang/cem/libcc.ansi/stdio/fillbuf.c b/lang/cem/libcc.ansi/stdio/fillbuf.c index c6b811ec0..1fea48bdb 100644 --- a/lang/cem/libcc.ansi/stdio/fillbuf.c +++ b/lang/cem/libcc.ansi/stdio/fillbuf.c @@ -13,6 +13,7 @@ int __fillbuf(register FILE *stream) { static unsigned char ch[FOPEN_MAX]; + register int i; stream->_count = 0; if (fileno(stream) < 0) return EOF; @@ -33,13 +34,12 @@ __fillbuf(register FILE *stream) stream->_bufsiz = BUFSIZ; } } - if (io_testflag(stream, _IONBF | _IOLBF)) { - register int i; - for (i = 0; i < FOPEN_MAX; i++) { - if (__iotab[i] && io_testflag(__iotab[i], _IOLBF)) - if (io_testflag(__iotab[i], _IOWRITING)) - (void) fflush(__iotab[i]); - } + + /* flush line-buffered output when filling an input buffer */ + for (i = 0; i < FOPEN_MAX; i++) { + if (__iotab[i] && io_testflag(__iotab[i], _IOLBF)) + if (io_testflag(__iotab[i], _IOWRITING)) + (void) fflush(__iotab[i]); } if (!stream->_buf) {