summaryrefslogtreecommitdiff
path: root/util-linux/more.c
diff options
context:
space:
mode:
authorEric Andersen2003-09-15 08:33:45 +0000
committerEric Andersen2003-09-15 08:33:45 +0000
commit8efe967018dd79aacfe3ca1e2583f115d744e466 (patch)
tree7590704be6cf03c87242043f5909e12eb4150356 /util-linux/more.c
parentc4f72d1426e03f046ac54a00d733a4a52c3a5d4b (diff)
downloadbusybox-8efe967018dd79aacfe3ca1e2583f115d744e466.zip
busybox-8efe967018dd79aacfe3ca1e2583f115d744e466.tar.gz
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/more.c')
-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 1ec3007..f4018f5 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -69,10 +69,6 @@ extern int more_main(int argc, char **argv)
FILE *file;
int len, page_height;
-#if defined CONFIG_FEATURE_AUTOWIDTH && defined CONFIG_FEATURE_USE_TERMIOS
- struct winsize win = { 0, 0, 0, 0 };
-#endif
-
argc--;
argv++;
@@ -115,13 +111,12 @@ extern int more_main(int argc, char **argv)
if(please_display_more_prompt>0)
please_display_more_prompt = 0;
-#if defined CONFIG_FEATURE_AUTOWIDTH && defined CONFIG_FEATURE_USE_TERMIOS
- ioctl(fileno(stdout), TIOCGWINSZ, &win);
- if (win.ws_row > 4)
- terminal_height = win.ws_row - 2;
- if (win.ws_col > 0)
- terminal_width = win.ws_col - 1;
-#endif
+ get_terminal_width_height(0, &terminal_width, &terminal_height);
+ if (terminal_height > 4)
+ terminal_height -= 2;
+ if (terminal_width > 0)
+ terminal_width -= 1;
+
len=0;
lines = 0;
page_height = terminal_height;