Restore the end-of-file detection for buffered streams whose read ahead is allowed.
[INTERPRETER] * BUG: Standard input does not use read ahead anymore in all cases. * BUG: Restore the end-of-file detection for buffered streams whose read ahead is allowed.
This commit is contained in:
parent
7fddd745ff
commit
3e0eb272a3
2 changed files with 9 additions and 8 deletions
|
@ -158,11 +158,11 @@ CFILE *CFILE_create(STREAM *stream, int mode)
|
|||
static CFILE *create_default_stream(FILE *file, int mode)
|
||||
{
|
||||
STREAM stream;
|
||||
bool tty = isatty(fileno(file));
|
||||
//bool tty = isatty(fileno(file));
|
||||
|
||||
CLEAR(&stream);
|
||||
stream.type = &STREAM_buffer;
|
||||
stream.common.no_read_ahead = tty;
|
||||
stream.common.no_read_ahead = TRUE;
|
||||
stream.common.standard = TRUE;
|
||||
stream.common.check_read = TRUE;
|
||||
stream.buffer.file = file;
|
||||
|
|
|
@ -163,19 +163,20 @@ static int stream_tell(STREAM *stream, int64_t *pos)
|
|||
|
||||
static int stream_eof(STREAM *stream)
|
||||
{
|
||||
return !FD || feof(FD);
|
||||
|
||||
/*int c;
|
||||
int c;
|
||||
|
||||
if (!FD)
|
||||
if (!FD || feof(FD) || stream->common.eof)
|
||||
return TRUE;
|
||||
|
||||
|
||||
if (stream->common.no_read_ahead)
|
||||
return FALSE;
|
||||
|
||||
c = fgetc(FD);
|
||||
if (c == EOF)
|
||||
return TRUE;
|
||||
|
||||
ungetc(c, FD);
|
||||
return FALSE;*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue