always flush line-buffered output when filling an input buffer
This commit is contained in:
parent
6c5c8c980e
commit
472ee0cea4
1 changed files with 7 additions and 7 deletions
|
@ -13,6 +13,7 @@ int
|
||||||
__fillbuf(register FILE *stream)
|
__fillbuf(register FILE *stream)
|
||||||
{
|
{
|
||||||
static unsigned char ch[FOPEN_MAX];
|
static unsigned char ch[FOPEN_MAX];
|
||||||
|
register int i;
|
||||||
|
|
||||||
stream->_count = 0;
|
stream->_count = 0;
|
||||||
if (fileno(stream) < 0) return EOF;
|
if (fileno(stream) < 0) return EOF;
|
||||||
|
@ -33,14 +34,13 @@ __fillbuf(register FILE *stream)
|
||||||
stream->_bufsiz = BUFSIZ;
|
stream->_bufsiz = BUFSIZ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (io_testflag(stream, _IONBF | _IOLBF)) {
|
|
||||||
register int i;
|
/* flush line-buffered output when filling an input buffer */
|
||||||
for (i = 0; i < FOPEN_MAX; i++) {
|
for (i = 0; i < FOPEN_MAX; i++) {
|
||||||
if (__iotab[i] && io_testflag(__iotab[i], _IOLBF))
|
if (__iotab[i] && io_testflag(__iotab[i], _IOLBF))
|
||||||
if (io_testflag(__iotab[i], _IOWRITING))
|
if (io_testflag(__iotab[i], _IOWRITING))
|
||||||
(void) fflush(__iotab[i]);
|
(void) fflush(__iotab[i]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!stream->_buf) {
|
if (!stream->_buf) {
|
||||||
stream->_buf = &ch[fileno(stream)];
|
stream->_buf = &ch[fileno(stream)];
|
||||||
|
|
Loading…
Reference in a new issue