Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/tset Set "lines" and "columns" if ioctl(TIOCGWINSZ) ...



details:   https://anonhg.NetBSD.org/src/rev/853e711d5060
branches:  trunk
changeset: 487408:853e711d5060
user:      simonb <simonb%NetBSD.org@localhost>
date:      Wed Jun 07 13:18:36 2000 +0000

description:
Set "lines" and "columns" if ioctl(TIOCGWINSZ) returns something useful.

diffstat:

 usr.bin/tset/tset.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 754f9f486683 -r 853e711d5060 usr.bin/tset/tset.c
--- a/usr.bin/tset/tset.c       Wed Jun 07 13:07:41 2000 +0000
+++ b/usr.bin/tset/tset.c       Wed Jun 07 13:18:36 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tset.c,v 1.10 2000/05/31 05:50:06 blymn Exp $  */
+/*     $NetBSD: tset.c,v 1.11 2000/06/07 13:18:36 simonb Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)tset.c     8.1 (Berkeley) 6/9/93";
 #endif
-__RCSID("$NetBSD: tset.c,v 1.10 2000/05/31 05:50:06 blymn Exp $");
+__RCSID("$NetBSD: tset.c,v 1.11 2000/06/07 13:18:36 simonb Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -175,7 +175,10 @@
 #ifdef TIOCGWINSZ
                /* Set window size */
                (void)ioctl(STDERR_FILENO, TIOCGWINSZ, &win);
-               if (win.ws_row == 0 && win.ws_col == 0 &&
+               if (win.ws_row > 0 && win.ws_col > 0) {
+                       lines = win.ws_row;
+                       columns = win.ws_col;
+               } else if (win.ws_row == 0 && win.ws_col == 0 &&
                    lines > 0 && columns > 0) {
                        win.ws_row = lines;
                        win.ws_col = columns;



Home | Main Index | Thread Index | Old Index