summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-12-18 00:59:05 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-12-18 00:59:05 +0000
commit2a260d4c1d82b7e7020a744e517df08fd6dfec0d (patch)
tree8008cd02d1d0a322bb6a7f51bdced7830a441da6
parenta20f870c5b344d1e5ece5064cd0e928ea4f4a699 (diff)
Use more standard TIOCGSIZE instead of the older TIOCGWINSZ.
They are the same thing on OpenBSD anyway...
-rw-r--r--lib/libocurses/setterm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libocurses/setterm.c b/lib/libocurses/setterm.c
index 3544b4dfae4..fb76d183350 100644
--- a/lib/libocurses/setterm.c
+++ b/lib/libocurses/setterm.c
@@ -31,7 +31,7 @@
static char sccsid[] = "@(#)setterm.c 8.7 (Berkeley) 7/27/94";
#endif /* not lint */
-#include <sys/ioctl.h> /* TIOCGWINSZ on old systems. */
+#include <sys/ioctl.h>
#include <stdlib.h>
#include <string.h>
@@ -84,7 +84,7 @@ setterm(type)
static char genbuf[1024];
static char __ttytype[1024];
register int unknown;
- struct winsize win;
+ struct ttysize win;
char *p;
#ifdef DEBUG
@@ -102,11 +102,11 @@ setterm(type)
__CTRACE("setterm: tty = %s\n", type);
#endif
- /* Try TIOCGWINSZ, and, if it fails, the termcap entry. */
- if (ioctl(STDERR_FILENO, TIOCGWINSZ, &win) != -1 &&
- win.ws_row != 0 && win.ws_col != 0) {
- LINES = win.ws_row;
- COLS = win.ws_col;
+ /* Try TIOCGSIZE, and, if it fails, the termcap entry. */
+ if (ioctl(STDERR_FILENO, TIOCGSIZE, &win) != -1 &&
+ win.ts_lines != 0 && win.ts_cols != 0) {
+ LINES = win.ts_lines;
+ COLS = win.ts_cols;
} else {
LINES = tgetnum("li");
COLS = tgetnum("co");