aboutsummaryrefslogtreecommitdiff
path: root/win32/termios.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2014-03-19 11:44:05 +0000
committerRon Yorston <rmy@pobox.com>2014-03-19 11:44:05 +0000
commit114ddd900acf9de27cc9e651d0af26df3948d34f (patch)
tree2dacb8e311a33e319a8bd6385efff890487a7ba9 /win32/termios.c
parentcfb45378f7ecbfa87ad0b61e9463dd83bc5ce615 (diff)
downloadbusybox-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.c3
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 }