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