|
From: Kohn E. D. <em...@cs...> - 2002-05-01 14:35:12
|
There are two more problems with REACTOS' stdio:
1) stdin does not translate the end-of-line characters correctly
If stdin is redirected to the keyboard, stdin has to translate the ENTER
key ('\r') into '\n'.
On the other hand, if stdin is redirected from a file, and the file
is opened in text mode (which is the default for stdin), the end-of-line
sequence is CR+LF ('\r' + '\n'). This squence must also be translated to
'\n'. However if we want to be nice with UNIX text files, it's a good idea
to support a single '\n' as the end-of-line marker as well.
2) Another problem is with the _istty() function.
_istty(_fileno(stdin)) is supposed to return non-zero if stdin is
redirected to the keyboard, and zero otherwise. _istty(_fileno(stdin))
always returns zero on REACTOS.
Emil
On Wed, 1 May 2002, Jason Filby wrote:
> Hey all
>
> I'm trying to track down a bug in gets (in msvcrt). Here's the problem, based on the calls made:
>
> 1: gets calls getchar to get each character, checking for \n or EOF
> 2: getchar calls getc, using STDIN as the file handle
> 3: getc calls _filbuf, again passing the file handle (STDIN)
> 4: _filbuf calls _read
> 5: _read calls ReadFile
> 6: ReadFile calls ReadConsoleA because IsConsoleHandle returns true
>
> ReadConsoleA gets a series of characters from the keyboard and only returns when it gets a \n. So in effect, getchar is getting an entire string from the console instead of a single character.
>
> At which point is the fault? Should ReadFile call ReadConsoleA? Or perhaps is the fault in calling _filbuf? I don't know... I really need some advice on this.
>
> Thanks!!
>
> - Jason
>
|