Commit 3e0eb272 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

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.
parent 7fddd745
Pipeline #351841989 passed with stage
in 26 minutes and 28 seconds
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment