diff options
author | Ron Yorston <rmy@pobox.com> | 2023-03-06 12:25:39 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-03-06 12:25:39 +0000 |
commit | b50470de96320425adbed82129bdb7f7f5263ddb (patch) | |
tree | 129ee385d0d9c658eb7f71717372ea496dd604e1 /libbb/read_key.c | |
parent | 8ade494aebe60ea14026d48025a462e6d0b58a7f (diff) | |
download | busybox-w32-b50470de96320425adbed82129bdb7f7f5263ddb.tar.gz busybox-w32-b50470de96320425adbed82129bdb7f7f5263ddb.tar.bz2 busybox-w32-b50470de96320425adbed82129bdb7f7f5263ddb.zip |
win32: virtual terminal input fixes
- Disable ENABLE_PROCESSED_INPUT in raw mode. Otherwise ^C isn't
immediately detected during shell command line editing with
virtual terminal input enabled.
- Switch read_key()/unix_readkey() to windows_read_key()/read_key().
This allows the shell `read` builtin to use windows_read_key().
Without this change `read` fails when virtual terminal input is
enabled.
Diffstat (limited to 'libbb/read_key.c')
-rw-r--r-- | libbb/read_key.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libbb/read_key.c b/libbb/read_key.c index c34770028..54886cc9c 100644 --- a/libbb/read_key.c +++ b/libbb/read_key.c | |||
@@ -9,11 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | #include "libbb.h" | 10 | #include "libbb.h" |
11 | 11 | ||
12 | #if ENABLE_PLATFORM_MINGW32 | ||
13 | int64_t FAST_FUNC unix_read_key(int fd, char *buffer, int timeout) | ||
14 | #else | ||
15 | int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout) | 12 | int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout) |
16 | #endif | ||
17 | { | 13 | { |
18 | struct pollfd pfd; | 14 | struct pollfd pfd; |
19 | const char *seq; | 15 | const char *seq; |
@@ -116,6 +112,11 @@ int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout) | |||
116 | 0 | 112 | 0 |
117 | }; | 113 | }; |
118 | 114 | ||
115 | #if ENABLE_PLATFORM_MINGW32 | ||
116 | if (!(terminal_mode(FALSE) & VT_INPUT)) | ||
117 | return windows_read_key(fd, buffer, timeout); | ||
118 | #endif | ||
119 | |||
119 | pfd.fd = fd; | 120 | pfd.fd = fd; |
120 | pfd.events = POLLIN; | 121 | pfd.events = POLLIN; |
121 | 122 | ||