* 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.
This commit is contained in:
parent
3b09c754da
commit
610739191f
|
@ -1,3 +1,14 @@
|
||||||
|
2000-07-04 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Mon Jul 3 16:09:16 2000 Christopher Faylor <cgf@cygnus.com>
|
Mon Jul 3 16:09:16 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* exceptions.cc (stack_info::walk): Use method to find offset.
|
* exceptions.cc (stack_info::walk): Use method to find offset.
|
||||||
|
|
|
@ -613,15 +613,6 @@ dll_crt0_1 ()
|
||||||
/* Set the os_being_run global. */
|
/* Set the os_being_run global. */
|
||||||
set_os_type ();
|
set_os_type ();
|
||||||
|
|
||||||
/* If we didn't call SetFileApisToOEM, console I/O calls would use a
|
|
||||||
different codepage than other Win32 API calls. In some languages
|
|
||||||
(not English), this would result in "cat > filename" creating a file
|
|
||||||
by a different name than if CreateFile was used to create filename.
|
|
||||||
SetFileApisToOEM prevents this problem by making all calls use the
|
|
||||||
OEM codepage. */
|
|
||||||
|
|
||||||
SetFileApisToOEM ();
|
|
||||||
|
|
||||||
/* Initialize the host dependent constants object. */
|
/* Initialize the host dependent constants object. */
|
||||||
host_dependent.init ();
|
host_dependent.init ();
|
||||||
|
|
||||||
|
@ -698,7 +689,6 @@ dll_crt0_1 ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *line = GetCommandLineA ();
|
char *line = GetCommandLineA ();
|
||||||
CharToOem (line, line);
|
|
||||||
|
|
||||||
line = strcpy ((char *) alloca (strlen (line) + 1), line);
|
line = strcpy ((char *) alloca (strlen (line) + 1), line);
|
||||||
|
|
||||||
|
@ -1156,7 +1146,7 @@ static void
|
||||||
dummy_autoload (void)
|
dummy_autoload (void)
|
||||||
{
|
{
|
||||||
LoadDLLinit (user32)
|
LoadDLLinit (user32)
|
||||||
LoadDLLfunc (CharToOemA, 8, user32)
|
LoadDLLfunc (CharToOemBuffA, 12, user32)
|
||||||
LoadDLLfunc (CreateWindowExA, 48, user32)
|
LoadDLLfunc (CreateWindowExA, 48, user32)
|
||||||
LoadDLLfunc (DefWindowProcA, 16, user32)
|
LoadDLLfunc (DefWindowProcA, 16, user32)
|
||||||
LoadDLLfunc (DispatchMessageA, 4, user32)
|
LoadDLLfunc (DispatchMessageA, 4, user32)
|
||||||
|
@ -1168,8 +1158,7 @@ LoadDLLfunc (GetUserObjectInformationA, 20, user32)
|
||||||
LoadDLLfunc (KillTimer, 8, user32)
|
LoadDLLfunc (KillTimer, 8, user32)
|
||||||
LoadDLLfunc (MessageBoxA, 16, user32)
|
LoadDLLfunc (MessageBoxA, 16, user32)
|
||||||
LoadDLLfunc (MsgWaitForMultipleObjects, 20, user32)
|
LoadDLLfunc (MsgWaitForMultipleObjects, 20, user32)
|
||||||
LoadDLLfunc (OemToCharA, 8, user32)
|
LoadDLLfunc (OemToCharBuffA, 12, user32)
|
||||||
LoadDLLfunc (OemToCharW, 8, user32)
|
|
||||||
LoadDLLfunc (PeekMessageA, 20, user32)
|
LoadDLLfunc (PeekMessageA, 20, user32)
|
||||||
LoadDLLfunc (PostMessageA, 16, user32)
|
LoadDLLfunc (PostMessageA, 16, user32)
|
||||||
LoadDLLfunc (PostQuitMessage, 4, user32)
|
LoadDLLfunc (PostQuitMessage, 4, user32)
|
||||||
|
|
|
@ -179,7 +179,9 @@ fhandler_console::read (void *pv, size_t buflen)
|
||||||
!input_rec.Event.KeyEvent.bKeyDown)
|
!input_rec.Event.KeyEvent.bKeyDown)
|
||||||
continue;
|
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);
|
toadd = get_nonascii_key (input_rec);
|
||||||
if (!toadd)
|
if (!toadd)
|
||||||
|
@ -187,7 +189,10 @@ fhandler_console::read (void *pv, size_t buflen)
|
||||||
nread = strlen (toadd);
|
nread = strlen (toadd);
|
||||||
}
|
}
|
||||||
else if (!(input_rec.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED))
|
else if (!(input_rec.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED))
|
||||||
toadd = &ich;
|
{
|
||||||
|
OemToCharBuff (&ich, &ich, 1);
|
||||||
|
toadd = &ich;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static char tmp[2];
|
static char tmp[2];
|
||||||
|
@ -1024,13 +1029,20 @@ fhandler_console::write_normal (const unsigned char *src,
|
||||||
/* Print all the base ones out */
|
/* Print all the base ones out */
|
||||||
if (found != src)
|
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 ());
|
debug_printf ("write failed, handle %p", get_output_handle ());
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
src += done;
|
len -= done;
|
||||||
|
src += done;
|
||||||
|
} while (len > 0);
|
||||||
}
|
}
|
||||||
if (src < end)
|
if (src < end)
|
||||||
{
|
{
|
||||||
|
|
|
@ -547,8 +547,7 @@ _link (const char *a, const char *b)
|
||||||
|
|
||||||
lpContext = NULL;
|
lpContext = NULL;
|
||||||
cygwin_conv_to_full_win32_path (real_b.get_win32 (), buf);
|
cygwin_conv_to_full_win32_path (real_b.get_win32 (), buf);
|
||||||
OemToCharW (buf, wbuf);
|
cbPathLen = MultiByteToWideChar (CP_ACP, 0, buf, -1, wbuf, MAX_PATH) * sizeof (WCHAR);
|
||||||
cbPathLen = (strlen (buf) + 1) * sizeof (WCHAR);
|
|
||||||
|
|
||||||
StreamId.dwStreamId = BACKUP_LINK;
|
StreamId.dwStreamId = BACKUP_LINK;
|
||||||
StreamId.dwStreamAttributes = 0;
|
StreamId.dwStreamAttributes = 0;
|
||||||
|
|
Loading…
Reference in New Issue