Mail Archives: djgpp-workers/2002/05/08/15:03:50
> Date: Wed, 8 May 2002 08:33:38 -0700
> From: Zack Weinberg <zack AT codesourcery DOT com>
>
> > For other systems, I guess a warning under -W is okay.
>
> With or without truncating the input file?
Without, I guess: on any other system, you cannot be sure that the
file with a ^Z came from a DOSish platform. I expect Unix and
GNU/Linux users outcry if/when they find out that a ^Z causes GCC to
stop reading.
> Is ^Z to be honored wherever it appears, or only immediately after a
> newline sequence?
There's no relation between ^Z and newlines whatsoever. Old DOS
editors could put a ^Z anywhere, including several ^Zs one after
another.
> > I hope only when the input comes from a file, not from a terminal.
>
> It makes no distinction. What goes wrong when one reads from a
> terminal in binary mode under DOS?
You don't have echo, and you cannot easily stop the input (because ^Z
is no longer special to the system calls, and because binary input is
not line-buffered, so many characters are needed before the program
actually sees the ^Z). Many users decide at this point that the
program has a bug and want to interrupt it. However, due to
peculiarities of signal support, Ctrl-C is also disabled when the
terminal device is in binary mode (think about using Emacs), so
interrupting also doesn't work. That's when the user decides their
system is wedged cold, and reboots it...
In other words, switching the terminal to binary mode has too many
nasty side effects.
> (I'm not sure how to open a file in text mode using open(),
> incidentally)
Either O_TEXT in `open' or "rt" in `fopen'. (I hope I understood the
question, since I think you already know that.)
- Raw text -