PATCH: MinGW readline -- revised

Mark Mitchell mark@codesourcery.com
Mon Jul 25 00:41:00 GMT 2005


Christopher Faylor wrote:

Thanks for the review.

> *** readline/input.c    8 Dec 2002 22:31:37 -0000       1.5
> --- readline/input.c    18 Jul 2005 23:59:21 -0000
> *************** rl_getc (stream)
> *** 422,431 ****
> --- 422,438 ----
>     int result;
>     unsigned char c;
> 
>     while (1)
>       {
> + #ifdef __MINGW32__
> +       /* On Windows, use a special routine to read a single  character
> +        from the console.  (Otherwise, no characters are available
> +        until the user hits the return key.)  */
> +       if (isatty (fileno (stream)))
> +       return getch ();
> + #endif
>         result = read (fileno (stream), &c, sizeof (unsigned char));
> 
>         if (result == sizeof (unsigned char))
>         return (c);
> 
> 
> This doesn't look right.  Shouldn't there be an ifdef there?  It's a
> minor point but it looks like this would potentially produce dead code.

If the stream is *not* a TTY, then we still want to use the ordinary 
code.  There's just this one special case for TTYs.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304



More information about the Gdb-patches mailing list