[BusyBox-cvs] busybox/util-linux more.c,1.57,1.58

Erik Andersen andersen at busybox.net
Mon Sep 15 08:34:09 UTC 2003


Update of /var/cvs/busybox/util-linux
In directory winder:/tmp/cvs-serv10511/util-linux

Modified Files:
	more.c 
Log Message:
Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize)
to ensure proper fallback behavior on, i.e. serial consoles.
 -Erik


Index: more.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/more.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- more.c	14 Jul 2003 21:21:07 -0000	1.57
+++ more.c	15 Sep 2003 08:33:42 -0000	1.58
@@ -69,10 +69,6 @@
 	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 @@
 		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;




More information about the busybox-cvs mailing list