aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-09-15 08:33:45 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-09-15 08:33:45 +0000
commit7531d242c93e4ff7d3b2ebeeaf1f0de4dcb6b71c (patch)
tree7590704be6cf03c87242043f5909e12eb4150356 /util-linux
parentfc2b3bc3efa6de860a1d3a961c700650e1a590eb (diff)
downloadbusybox-w32-7531d242c93e4ff7d3b2ebeeaf1f0de4dcb6b71c.tar.gz
busybox-w32-7531d242c93e4ff7d3b2ebeeaf1f0de4dcb6b71c.tar.bz2
busybox-w32-7531d242c93e4ff7d3b2ebeeaf1f0de4dcb6b71c.zip
Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize)
to ensure proper fallback behavior on, i.e. serial consoles. -Erik git-svn-id: svn://busybox.net/trunk/busybox@7526 69ca8d6d-28ef-0310-b511-8ec308f3f277
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;