aboutsummaryrefslogtreecommitdiff
path: root/console-tools/resize.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-10 16:32:14 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-10 16:32:14 +0000
commit4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5 (patch)
tree8cb052205ab9f9e97233afe39ddb2c6253ab8d1a /console-tools/resize.c
parent2b52b2797bae774656b3f79ed1939a08fbed7b0e (diff)
downloadbusybox-4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5.tar.gz
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
Diffstat (limited to 'console-tools/resize.c')
-rw-r--r--console-tools/resize.c8
1 files changed, 5 insertions, 3 deletions
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",