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/winsup.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/winsup.h') diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 308620e34..d2f475ba2 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -83,13 +83,16 @@ extern "C" DWORD WINAPI GetLastError (void); enum os_type {winNT = 1, win95, win98, winME, win32s, unknown}; extern os_type os_being_run; +enum codepage_type {ansi_cp, oem_cp}; +extern codepage_type current_codepage; + /* Used to check if Cygwin DLL is dynamically loaded. */ extern int dynamically_loaded; #define sys_wcstombs(tgt,src,len) \ - WideCharToMultiByte(CP_ACP,0,(src),-1,(tgt),(len),NULL,NULL) + WideCharToMultiByte((current_codepage==ansi_cp?CP_ACP:CP_OEMCP),0,(src),-1,(tgt),(len),NULL,NULL) #define sys_mbstowcs(tgt,src,len) \ - MultiByteToWideChar(CP_ACP,0,(src),-1,(tgt),(len)) + MultiByteToWideChar((current_codepage==ansi_cp?CP_ACP:CP_OEMCP),0,(src),-1,(tgt),(len)) #define TITLESIZE 1024 #define MAX_USER_NAME 20 @@ -182,6 +185,8 @@ extern HANDLE netapi32_handle; extern "C" void error_start_init (const char*); extern "C" int try_to_debug (); +extern "C" void codepage_init (const char*); + extern int cygwin_finished_initializing; /**************************** Miscellaneous ******************************/ -- cgit v1.2.3