diff options
author | Ron Yorston <rmy@pobox.com> | 2014-03-19 11:44:05 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2014-03-19 11:44:05 +0000 |
commit | 114ddd900acf9de27cc9e651d0af26df3948d34f (patch) | |
tree | 2dacb8e311a33e319a8bd6385efff890487a7ba9 /win32/termios.c | |
parent | cfb45378f7ecbfa87ad0b61e9463dd83bc5ce615 (diff) | |
download | busybox-w32-114ddd900acf9de27cc9e651d0af26df3948d34f.tar.gz busybox-w32-114ddd900acf9de27cc9e651d0af26df3948d34f.tar.bz2 busybox-w32-114ddd900acf9de27cc9e651d0af26df3948d34f.zip |
Use OEM codepage for console I/O
Windows console applications use different codepages for console I/O
and the rest of the API:
http://msdn.microsoft.com/en-us/goglobal/bb688114.aspx#E2F
Attempt to workaround this by converting characters when they're read from
and written to the console. Not all possible paths are handled.
Diffstat (limited to 'win32/termios.c')
-rw-r--r-- | win32/termios.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/win32/termios.c b/win32/termios.c index ad6ab117f..40e70309e 100644 --- a/win32/termios.c +++ b/win32/termios.c | |||
@@ -16,6 +16,7 @@ int64_t FAST_FUNC read_key(int fd, char *buf UNUSED_PARAM, int timeout) | |||
16 | INPUT_RECORD record; | 16 | INPUT_RECORD record; |
17 | DWORD nevent_out, mode; | 17 | DWORD nevent_out, mode; |
18 | int ret = -1; | 18 | int ret = -1; |
19 | char *s; | ||
19 | 20 | ||
20 | if (fd != 0) | 21 | if (fd != 0) |
21 | bb_error_msg_and_die("read_key only works on stdin"); | 22 | bb_error_msg_and_die("read_key only works on stdin"); |
@@ -74,6 +75,8 @@ int64_t FAST_FUNC read_key(int fd, char *buf UNUSED_PARAM, int timeout) | |||
74 | } | 75 | } |
75 | continue; | 76 | continue; |
76 | } | 77 | } |
78 | s = &record.Event.KeyEvent.uChar.AsciiChar; | ||
79 | OemToCharBuff(s, s, 1); | ||
77 | ret = record.Event.KeyEvent.uChar.AsciiChar; | 80 | ret = record.Event.KeyEvent.uChar.AsciiChar; |
78 | break; | 81 | break; |
79 | } | 82 | } |