Mail Archives: djgpp/1994/05/29/07:24:17
Eric Backus wrote:
> Keeping track is fine for files opened by the program, but you can't
> do that for stdin, stdout, and stderr. All you have for those is a
> file handle...
As an aside on the standard files: I recently ported Diffutils to DJGPP and
were bugged by the following problem. When DIFF discovers that a file is
BINARY, it must (under DOS) reopen it in BINARY mode, otherwise read() will
stop at the first ^Z character, and the files have a high probability of being
falsely declared identical (in fact, the version of DIFF distributed with
DJGPP has exactly this bug). Now, if DIFF reads from stdin (which might be a
pipe or a redirected file), I couldn't find a way to change the file's reading
mode, so this was a lossage in my case: couldn't correctly handle binary files
if one of them comes via stdin.
My question is: is there ANY way to change open mode (TEXT vs BINARY) of the
stdin stream WITHOUT reopening it (which we obviously cannot do, as indicated
by Eric Backus)? I think there is no PORTABLE (i.e. ANSI) way, but maybe
something DOS-specific or DJGPP-specific?
Eli Zaretskii
- Raw text -