From ee1d77e4b71f7166d4d8ada84a062bfc73da90e6 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 10 Dec 2000 00:45:12 +0000 Subject: * autoload.cc: Autoload CharToOemA. * dcrt0.cc (dll_crt0_1): Translate command line to OEM if current codepage is OEM. * environ.cc: Add new option 'codepage' to CYGWIN environment variable. * fhandler_clipboard.cc (fhandler_clipboard::read): Read clipboard in OEM mode if current codepage is OEM. * fhandler_console.cc (fhandler_console::read): Only translate console input if current codepage is ANSI. * fhandler_console.cc (fhandler_console::write_normal): Translate output data if current codepage is ANSI. * pinfo.cc (codepage_init): New function. Setup current codepage from CYGWIN environment variable and set codepage for file APIs. * security.cc (read_sd): Translate file name to it if current codepage is OEM. * winsup.h: (sys_wcstombs,sys_mbstowcs): Use current codepage for translations between multibyte and widechar string and vice versa. --- winsup/cygwin/fhandler_console.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/fhandler_console.cc') diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index cfc569b29..270e3856a 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -217,7 +217,7 @@ fhandler_console::read (void *pv, size_t buflen) tmp[1] = ich; /* Need this check since US code page seems to have a bug when converting a CTRL-U. */ - if ((unsigned char)ich > 0x7f) + if ((unsigned char)ich > 0x7f && current_codepage == ansi_cp) OemToCharBuff (tmp + 1, tmp + 1, 1); if (!(input_rec.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED)) toadd = tmp + 1; @@ -1163,7 +1163,10 @@ fhandler_console::write_normal (const unsigned char *src, size_t len = found - src; do { size_t l2 = min (sizeof (buf), len); - CharToOemBuff ((LPCSTR)src, buf, l2); + if (current_codepage == ansi_cp) + CharToOemBuff ((LPCSTR)src, buf, l2); + else + strncpy (buf, (LPCSTR)src, l2); if (! WriteFile (get_output_handle (), buf, l2, &done, 0)) { debug_printf ("write failed, handle %p", get_output_handle ()); -- cgit v1.2.3