Re: [RFA] windows-nat.c: Enable processed input at startup

Christopher Faylor
2010-04-26T15:20:18Z

On Mon, Apr 26, 2010 at 05:07:40PM +0200, Pierre Muller wrote:
>
>> >+ std_in_handle = CreateFile ("CONIN$", GENERIC_READ | GENERIC_WRITE,
>> >+ FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
>> >+
>> >+ if (std_in_handle != INVALID_HANDLE_VALUE)
>> >+ {
>> >+ DWORD console_mode;
>> >+ CHECK (GetConsoleMode (std_in_handle, &console_mode));
>> >+ console_mode = console_mode | ENABLE_PROCESSED_INPUT;
>> >+ CHECK (SetConsoleMode (std_in_handle, console_mode));
>> >+ }
>> >
>> > init_windows_ops ();
>>
>> That has to be conditional on __CYGWIN__ since you'll be screwing up
>> Cygwin's
>> notion of the console state.
>
> Is there a Cygwin way to do the same?
>
>> And, the name std_in_handle is a misnomer. It should be console_handle
>> or something like that.
> Renamed to conin_handle.
>> Can't you just set what you need and close the handle? I thought this
>> setting was global.
> Of course I should close the handle as soon as I changed the
>console mode.
> What about this version?
>
>Pierre
>
>2010-04-26 Pierre Muller <muller@ics.u-strasbg.fr>
>
> * windows-nat.c (_initialize_windows_nat): Try to set
> ENABLE_PROCESSED_INPUT for console mode if accessible.

Ok with the minor comment changes below.

I don't understand why this would be necessary for Cygwin but, if it is,
then tcsetattr should be used.

cgf