diff options
author | Ron Yorston <rmy@pobox.com> | 2023-03-05 12:33:01 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-03-05 12:33:01 +0000 |
commit | 9aef4d4d298987437e33bf25bcddd16175148d45 (patch) | |
tree | 172ada18bda876ec9041c74a3199d8a475e0fb3b /win32 | |
parent | 4020c7689c3f640e8a56edd1a1491403112857ec (diff) | |
download | busybox-w32-9aef4d4d298987437e33bf25bcddd16175148d45.tar.gz busybox-w32-9aef4d4d298987437e33bf25bcddd16175148d45.tar.bz2 busybox-w32-9aef4d4d298987437e33bf25bcddd16175148d45.zip |
win32: enable Unix read_key() for virtual terminal
Until now busybox-w32 has used a native Windows implementation
of read_key(). Build the upstream Unix implementation and use
it instead of the native version when virtual terminal input
mode is enabled.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/termios.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/win32/termios.c b/win32/termios.c index 4b3588826..20ec4dcc5 100644 --- a/win32/termios.c +++ b/win32/termios.c | |||
@@ -28,7 +28,7 @@ int tcgetattr(int fd, struct termios *t) | |||
28 | return 0; | 28 | return 0; |
29 | } | 29 | } |
30 | 30 | ||
31 | int64_t FAST_FUNC read_key(int fd, char *buf UNUSED_PARAM, int timeout) | 31 | int64_t FAST_FUNC read_key(int fd, char *buf, int timeout) |
32 | { | 32 | { |
33 | HANDLE cin = GetStdHandle(STD_INPUT_HANDLE); | 33 | HANDLE cin = GetStdHandle(STD_INPUT_HANDLE); |
34 | INPUT_RECORD record; | 34 | INPUT_RECORD record; |
@@ -41,6 +41,9 @@ int64_t FAST_FUNC read_key(int fd, char *buf UNUSED_PARAM, int timeout) | |||
41 | DWORD alt_pressed = FALSE; | 41 | DWORD alt_pressed = FALSE; |
42 | DWORD state; | 42 | DWORD state; |
43 | 43 | ||
44 | if (terminal_mode(FALSE) & VT_INPUT) | ||
45 | return unix_read_key(fd, buf, timeout); | ||
46 | |||
44 | if (fd != 0) | 47 | if (fd != 0) |
45 | bb_error_msg_and_die("read_key only works on stdin"); | 48 | bb_error_msg_and_die("read_key only works on stdin"); |
46 | if (cin == INVALID_HANDLE_VALUE) | 49 | if (cin == INVALID_HANDLE_VALUE) |