aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-03-05 12:34:31 +0000
committerRon Yorston <rmy@pobox.com>2023-03-05 12:43:46 +0000
commit8ade494aebe60ea14026d48025a462e6d0b58a7f (patch)
tree55181219752cf8c2efac037d8f2bd26c71baaca4 /util-linux
parent9aef4d4d298987437e33bf25bcddd16175148d45 (diff)
downloadbusybox-w32-8ade494aebe60ea14026d48025a462e6d0b58a7f.tar.gz
busybox-w32-8ade494aebe60ea14026d48025a462e6d0b58a7f.tar.bz2
busybox-w32-8ade494aebe60ea14026d48025a462e6d0b58a7f.zip
win32: add support for virtual terminal input
Alter certain applets to support virtual terminal input, if enabled. In many places this is achieved by building previously excluded upstream terminal-handling code. The busybox-w32 implementation of termios(3) functions does nothing if virtual terminal input is disabled, so it can be invoked regardless. Some applet-specific terminal-handling code is also required. This affects less, more, vi and command line editing in the shell. (The `more` applet isn't enabled in the default configuration.) This series of patches adds about 1.7KB to the binaries.
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/more.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/util-linux/more.c b/util-linux/more.c
index 07275131e..84ce37bc7 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -62,6 +62,7 @@ static void tcsetattr_tty_TCSANOW(struct termios *settings)
62 tcsetattr(G.tty_fileno, TCSANOW, settings); 62 tcsetattr(G.tty_fileno, TCSANOW, settings);
63} 63}
64 64
65#if !ENABLE_PLATFORM_MINGW32
65static void gotsig(int sig UNUSED_PARAM) 66static void gotsig(int sig UNUSED_PARAM)
66{ 67{
67 /* bb_putchar_stderr doesn't use stdio buffering, 68 /* bb_putchar_stderr doesn't use stdio buffering,
@@ -70,6 +71,7 @@ static void gotsig(int sig UNUSED_PARAM)
70 tcsetattr_tty_TCSANOW(&G.initial_settings); 71 tcsetattr_tty_TCSANOW(&G.initial_settings);
71 _exit(EXIT_FAILURE); 72 _exit(EXIT_FAILURE);
72} 73}
74#endif
73 75
74#define CONVERTED_TAB_SIZE 8 76#define CONVERTED_TAB_SIZE 8
75 77
@@ -159,12 +161,13 @@ int more_main(int argc UNUSED_PARAM, char **argv)
159 * to get input from the user. 161 * to get input from the user.
160 */ 162 */
161 for (;;) { 163 for (;;) {
162#if !ENABLE_PLATFORM_MINGW32
163 fflush_all(); 164 fflush_all();
164 input = getc(tty); 165#if ENABLE_PLATFORM_MINGW32
165#else 166 if (!(terminal_mode(FALSE) & VT_INPUT))
166 input = _getch(); 167 input = _getch();
168 else
167#endif 169#endif
170 input = getc(tty);
168 input = tolower(input); 171 input = tolower(input);
169 /* Erase the last message */ 172 /* Erase the last message */
170 printf("\r%*s\r", len, ""); 173 printf("\r%*s\r", len, "");