diff options
Diffstat (limited to 'console-tools/reset.c')
-rw-r--r-- | console-tools/reset.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/console-tools/reset.c b/console-tools/reset.c index 655a5ef7a..74fe3cb50 100644 --- a/console-tools/reset.c +++ b/console-tools/reset.c | |||
@@ -14,7 +14,11 @@ | |||
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_PLATFORM_MINGW32(IF_RESET(APPLET_NOFORK(reset, reset, BB_DIR_USR_BIN, BB_SUID_DROP, reset))) | ||
21 | //applet:IF_PLATFORM_POSIX(IF_RESET(APPLET_NOEXEC(reset, reset, BB_DIR_USR_BIN, BB_SUID_DROP, reset))) | ||
18 | 22 | ||
19 | //kbuild:lib-$(CONFIG_RESET) += reset.o | 23 | //kbuild:lib-$(CONFIG_RESET) += reset.o |
20 | 24 | ||
@@ -36,6 +40,7 @@ int stty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | |||
36 | int reset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 40 | int reset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
37 | int reset_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | 41 | int reset_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) |
38 | { | 42 | { |
43 | #if !ENABLE_PLATFORM_MINGW32 | ||
39 | static const char *const args[] ALIGN_PTR = { | 44 | static const char *const args[] ALIGN_PTR = { |
40 | "stty", "sane", NULL | 45 | "stty", "sane", NULL |
41 | }; | 46 | }; |
@@ -61,5 +66,14 @@ int reset_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
61 | execvp("stty", (char**)args); | 66 | execvp("stty", (char**)args); |
62 | #endif | 67 | #endif |
63 | } | 68 | } |
69 | #else | ||
70 | if (isatty(STDOUT_FILENO)) { | ||
71 | // "ESC [ m" -- Reset all display attributes | ||
72 | // "ESC [ ? 1049 l" -- Use normal screen buffer | ||
73 | // reset_screen -- Reset cursor and clear screen buffer | ||
74 | full_write1_str(ESC"[m" ESC"[?1049l"); | ||
75 | reset_screen(); | ||
76 | } | ||
77 | #endif | ||
64 | return EXIT_SUCCESS; | 78 | return EXIT_SUCCESS; |
65 | } | 79 | } |