PATCH: Use getche on Win32

Mark Mitchell mark@codesourcery.com
Tue May 10 11:45:00 GMT 2005


Eli Zaretskii wrote:
>>Date: Mon, 9 May 2005 13:15:50 -0700
>>From: Mark Mitchell <mark@codesourcery.com>
>>Cc: gdb-patches@sources.redhat.com
>>
>>Windows console semantics are different from UNIX.  If we just use
>>"read" to read what the user's typing, we end up blocking until a
>>newline is available, and even then there are some oddities.  The
>>easiest thing seems to be to use the special "getche" (short for "get
>>character with echo") routine which does the right thing.
>>
>>Reviews?
> 
> 
> What happens if you press one of the special keys, like Ctrl-C or the
> arrow keys or PageDown?  Does getche still DTRT?

Ctrl-C shows up as code 3, despite the fact that the documentation says 
that you can't read Ctrl-C.  The arrows and such are two-byte sequences; 
the first byte is 0xE0, while the second byte is a letter.  For example, 
left-arrow is 0xE0 0x50.  So, I'm not sure this entirely qualifies as 
"DTRT", but it's not totally broken either.

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



More information about the Gdb-patches mailing list