Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-07-04 06:26:20 +0400
committerChristopher Faylor <me@cgf.cx>2000-07-04 06:26:20 +0400
commit610739191f28a268d90a6b1c9c866e7435cfde84 (patch)
tree1aec671562e15d3ec1f8580143c90d644dcc6ad1 /winsup/cygwin/fhandler_console.cc
parent3b09c754da824fccaa85c4f1219599032e9a0676 (diff)
* dcrt0.cc (dll_crt0_1): Eliminate SetFileApisToOEM and CharToOem.
* (dummy_autoload): Add functions used in fhandler_console. * fhandler_console.cc (fhandler_console::read): Use ENCHANCED_KEY flag to distinguish extended keys. Translate an input character from the OEM code page to the ANSI code page. * (fhandler_console::write_normal): Translate output characters from the ANSI code page to the OEM code page. * syscalls.cc (_link): Use MultiByteToWideChar instead of OemToCharW.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r--winsup/cygwin/fhandler_console.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 4b87caaa0..7b19f3cc1 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -179,7 +179,9 @@ fhandler_console::read (void *pv, size_t buflen)
!input_rec.Event.KeyEvent.bKeyDown)
continue;
- if (ich == 0 || (ich & 0xff) == 0xe0) /* arrow/function keys */
+ if (ich == 0 ||
+ /* arrow/function keys */
+ (input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
{
toadd = get_nonascii_key (input_rec);
if (!toadd)
@@ -187,7 +189,10 @@ fhandler_console::read (void *pv, size_t buflen)
nread = strlen (toadd);
}
else if (!(input_rec.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED))
- toadd = &ich;
+ {
+ OemToCharBuff (&ich, &ich, 1);
+ toadd = &ich;
+ }
else
{
static char tmp[2];
@@ -1024,13 +1029,20 @@ fhandler_console::write_normal (const unsigned char *src,
/* Print all the base ones out */
if (found != src)
{
- if (! WriteFile (get_output_handle (), src, found - src, &done, 0))
+ char buf[256];
+ int len = found - src;
+ do {
+ int l2 = min (256, len);
+ CharToOemBuff ((LPCSTR)src, buf, l2);
+ if (! WriteFile (get_output_handle (), buf, l2, &done, 0))
{
debug_printf ("write failed, handle %p", get_output_handle ());
__seterrno ();
return 0;
}
- src += done;
+ len -= done;
+ src += done;
+ } while (len > 0);
}
if (src < end)
{