Mail Archives: cygwin-developers/1998/12/02/19:32:19
On Wed, Dec 02, 1998 at 09:42:42PM -0500, DJ Delorie wrote:
>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.
At that point in the function, the console is *guaranteed* to be in cooked
mode. If it sees a \r, then it should be ignored.
I think the code is correct, but then I would, because I wrote it.
--
cgf AT cygnus DOT com
http://www.cygnus.com/
- Raw text -