Mail Archives: cygwin-developers/1998/12/02/21:42:42
Corinna Vinschen wrote:
> in fhandler_console::read1() a short piece of code
> ignores CR if it is the one and only char in console input.
>
> I have found no circumstance, in which this code makes sense.
Be careful. If the console is in text mode, the \r character
will be stripped (i.e. crlf->nl conversion). If the user
asked to read one character, and it is stripped, the function
will report that zero characters were read. This is an EOF
indicator, even though it is not really EOF.
What the code should do is *if* the \r would be stripped,
it should read the following \n. If it can tell that
the \r is alone (no \n) but would be stripped, it should
probably change it to a \n. If the console is in binary
mode (no stripping), it can safely return a \r character.
- Raw text -