aboutsummaryrefslogtreecommitdiff
path: root/console-tools
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 /console-tools
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.
Diffstat (limited to 'console-tools')
-rw-r--r--console-tools/reset.c15
1 files changed, 14 insertions, 1 deletions
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}