From 4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 10 Mar 2007 16:32:14 +0000 Subject: more: do not mess with "/dev/console" (!); fill whole 1st screen (was "screen sans one line"); fall back to cat if redirected or no ctty less: fall back to cat if no ctty (was exiting) resize: cosmetics --- console-tools/resize.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'console-tools/resize.c') diff --git a/console-tools/resize.c b/console-tools/resize.c index 2fe5526fb..40a1b4ee0 100644 --- a/console-tools/resize.c +++ b/console-tools/resize.c @@ -9,6 +9,8 @@ /* no options, no getopt */ #include "busybox.h" +#define ESC "\033" + int resize_main(int argc, char **argv); int resize_main(int argc, char **argv) { @@ -27,10 +29,10 @@ int resize_main(int argc, char **argv) * get_cursor_pos [6n * restore_cursor_pos 8 */ - printf("\0337\033[r\033[999;999H\033[6n"); - scanf("\033[%hu;%huR", &w.ws_row, &w.ws_col); + printf(ESC"7" ESC"[r" ESC"[999;999H" ESC"[6n"); + scanf(ESC"[%hu;%huR", &w.ws_row, &w.ws_col); ret = ioctl(STDOUT_FILENO, TIOCSWINSZ, &w); - printf("\0338"); + printf(ESC"8"); tcsetattr(STDOUT_FILENO, TCSANOW, &old); if (ENABLE_FEATURE_RESIZE_PRINT) printf("COLUMNS=%d;LINES=%d;export COLUMNS LINES;\n", -- cgit v1.2.3