summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-09-15 08:33:45 +0000
committerEric Andersen <andersen@codepoet.org>2003-09-15 08:33:45 +0000
commit8efe967018dd79aacfe3ca1e2583f115d744e466 (patch)
tree7590704be6cf03c87242043f5909e12eb4150356 /util-linux
parentc4f72d1426e03f046ac54a00d733a4a52c3a5d4b (diff)
downloadbusybox-w32-8efe967018dd79aacfe3ca1e2583f115d744e466.tar.gz
busybox-w32-8efe967018dd79aacfe3ca1e2583f115d744e466.tar.bz2
busybox-w32-8efe967018dd79aacfe3ca1e2583f115d744e466.zip
Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize)
to ensure proper fallback behavior on, i.e. serial consoles. -Erik
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/more.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/util-linux/more.c b/util-linux/more.c
index 1ec3007bf..f4018f5d1 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -69,10 +69,6 @@ extern int more_main(int argc, char **argv)
69 FILE *file; 69 FILE *file;
70 int len, page_height; 70 int len, page_height;
71 71
72#if defined CONFIG_FEATURE_AUTOWIDTH && defined CONFIG_FEATURE_USE_TERMIOS
73 struct winsize win = { 0, 0, 0, 0 };
74#endif
75
76 argc--; 72 argc--;
77 argv++; 73 argv++;
78 74
@@ -115,13 +111,12 @@ extern int more_main(int argc, char **argv)
115 if(please_display_more_prompt>0) 111 if(please_display_more_prompt>0)
116 please_display_more_prompt = 0; 112 please_display_more_prompt = 0;
117 113
118#if defined CONFIG_FEATURE_AUTOWIDTH && defined CONFIG_FEATURE_USE_TERMIOS 114 get_terminal_width_height(0, &terminal_width, &terminal_height);
119 ioctl(fileno(stdout), TIOCGWINSZ, &win); 115 if (terminal_height > 4)
120 if (win.ws_row > 4) 116 terminal_height -= 2;
121 terminal_height = win.ws_row - 2; 117 if (terminal_width > 0)
122 if (win.ws_col > 0) 118 terminal_width -= 1;
123 terminal_width = win.ws_col - 1; 119
124#endif
125 len=0; 120 len=0;
126 lines = 0; 121 lines = 0;
127 page_height = terminal_height; 122 page_height = terminal_height;