summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-04-07 14:39:35 +0100
committerRon Yorston <rmy@pobox.com>2019-04-07 14:39:35 +0100
commitde3b8f89b1ea54ae51314e20c8d8d1c9b9fd14ad (patch)
tree3dc90f04175dcb4624b7578fe6aaf7f888409377
parenta5f8e300121686dba0ddcf2d7a3b3c432fbb0422 (diff)
downloadbusybox-w32-de3b8f89b1ea54ae51314e20c8d8d1c9b9fd14ad.tar.gz
busybox-w32-de3b8f89b1ea54ae51314e20c8d8d1c9b9fd14ad.tar.bz2
busybox-w32-de3b8f89b1ea54ae51314e20c8d8d1c9b9fd14ad.zip
reset: enable in default configuration
The 'reset' applet attempts to reset the screen. It's more thorough than 'clear'. Since it tries to reset the screen buffer for the current process it has to be a NOFORK applet. To run the Windows executable C:/Windows/System32/reset.exe use the full path, as the 'reset' applet will take precedence.
-rw-r--r--configs/mingw32_defconfig4
-rw-r--r--configs/mingw64_defconfig4
-rw-r--r--console-tools/reset.c15
3 files changed, 18 insertions, 5 deletions
diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig
index c3ba17a46..7800e9340 100644
--- a/configs/mingw32_defconfig
+++ b/configs/mingw32_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Busybox version: 1.31.0.git 3# Busybox version: 1.31.0.git
4# Sun Mar 31 09:45:46 2019 4# Sun Apr 7 12:34:37 2019
5# 5#
6CONFIG_HAVE_DOT_CONFIG=y 6CONFIG_HAVE_DOT_CONFIG=y
7# CONFIG_PLATFORM_POSIX is not set 7# CONFIG_PLATFORM_POSIX is not set
@@ -385,7 +385,7 @@ CONFIG_DEFAULT_SETFONT_DIR=""
385# CONFIG_FEATURE_LOADFONT_RAW is not set 385# CONFIG_FEATURE_LOADFONT_RAW is not set
386# CONFIG_LOADKMAP is not set 386# CONFIG_LOADKMAP is not set
387# CONFIG_OPENVT is not set 387# CONFIG_OPENVT is not set
388# CONFIG_RESET is not set 388CONFIG_RESET=y
389# CONFIG_RESIZE is not set 389# CONFIG_RESIZE is not set
390# CONFIG_FEATURE_RESIZE_PRINT is not set 390# CONFIG_FEATURE_RESIZE_PRINT is not set
391# CONFIG_SETCONSOLE is not set 391# CONFIG_SETCONSOLE is not set
diff --git a/configs/mingw64_defconfig b/configs/mingw64_defconfig
index 721420c06..f39e02fca 100644
--- a/configs/mingw64_defconfig
+++ b/configs/mingw64_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Busybox version: 1.31.0.git 3# Busybox version: 1.31.0.git
4# Sun Mar 31 09:45:46 2019 4# Sun Apr 7 12:34:37 2019
5# 5#
6CONFIG_HAVE_DOT_CONFIG=y 6CONFIG_HAVE_DOT_CONFIG=y
7# CONFIG_PLATFORM_POSIX is not set 7# CONFIG_PLATFORM_POSIX is not set
@@ -385,7 +385,7 @@ CONFIG_DEFAULT_SETFONT_DIR=""
385# CONFIG_FEATURE_LOADFONT_RAW is not set 385# CONFIG_FEATURE_LOADFONT_RAW is not set
386# CONFIG_LOADKMAP is not set 386# CONFIG_LOADKMAP is not set
387# CONFIG_OPENVT is not set 387# CONFIG_OPENVT is not set
388# CONFIG_RESET is not set 388CONFIG_RESET=y
389# CONFIG_RESIZE is not set 389# CONFIG_RESIZE is not set
390# CONFIG_FEATURE_RESIZE_PRINT is not set 390# CONFIG_FEATURE_RESIZE_PRINT is not set
391# CONFIG_SETCONSOLE is not set 391# CONFIG_SETCONSOLE is not set
diff --git a/console-tools/reset.c b/console-tools/reset.c
index 113bb5c76..2f65aad15 100644
--- a/console-tools/reset.c
+++ b/console-tools/reset.c
@@ -14,7 +14,10 @@
14//config: This program is used to reset the terminal screen, if it 14//config: This program is used to reset the terminal screen, if it
15//config: gets messed up. 15//config: gets messed up.
16 16
17//applet:IF_RESET(APPLET_NOEXEC(reset, reset, BB_DIR_USR_BIN, BB_SUID_DROP, reset)) 17// NOTE: For WIN32 this applet is NOFORK so we can change the screen
18// buffer for the current process.
19
20//applet:IF_RESET(APPLET_NOFORK(reset, reset, BB_DIR_USR_BIN, BB_SUID_DROP, reset))
18 21
19//kbuild:lib-$(CONFIG_RESET) += reset.o 22//kbuild:lib-$(CONFIG_RESET) += reset.o
20 23
@@ -36,6 +39,7 @@ int stty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
36int reset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 39int reset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
37int reset_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 40int reset_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
38{ 41{
42#if !ENABLE_PLATFORM_MINGW32
39 static const char *const args[] = { 43 static const char *const args[] = {
40 "stty", "sane", NULL 44 "stty", "sane", NULL
41 }; 45 };
@@ -61,5 +65,14 @@ int reset_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
61 execvp("stty", (char**)args); 65 execvp("stty", (char**)args);
62#endif 66#endif
63 } 67 }
68#else
69 if (isatty(STDOUT_FILENO)) {
70 // "ESC [ m" -- Reset all display attributes
71 // "ESC [ ? 1049 l" -- Use normal screen buffer
72 // reset_screen -- Reset cursor and clear screen buffer
73 full_write1_str(ESC"[m" ESC"[?1049l");
74 reset_screen();
75 }
76#endif
64 return EXIT_SUCCESS; 77 return EXIT_SUCCESS;
65} 78}