summaryrefslogtreecommitdiffstats
path: root/snake
diff options
context:
space:
mode:
authorderaadt <deraadt@NetBSD.org>1994-04-05 22:56:56 +0000
committerderaadt <deraadt@NetBSD.org>1994-04-05 22:56:56 +0000
commit9e697d61b90a53c5e0643f8d058d967bb144daaf (patch)
tree804459b4e0ccb52409e14661f06e40e37768d182 /snake
parentdcb1f7074d7ae9dd6c7a4777d494939863399377 (diff)
downloadbsdgames-darwin-9e697d61b90a53c5e0643f8d058d967bb144daaf.tar.gz
bsdgames-darwin-9e697d61b90a53c5e0643f8d058d967bb144daaf.tar.zst
bsdgames-darwin-9e697d61b90a53c5e0643f8d058d967bb144daaf.zip
TIOCGWINSZ
Diffstat (limited to 'snake')
-rw-r--r--snake/snake/move.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/snake/snake/move.c b/snake/snake/move.c
index 6eea0055..1f28ef99 100644
--- a/snake/snake/move.c
+++ b/snake/snake/move.c
@@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)move.c 5.8 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: move.c,v 1.6 1993/12/08 08:21:41 mycroft Exp $";
+static char rcsid[] = "$Id: move.c,v 1.7 1994/04/05 22:56:56 deraadt Exp $";
#endif /* not lint */
/*************************************************************************
@@ -548,6 +548,9 @@ getcap()
char *xPC;
struct point z;
void stop();
+#ifdef TIOCGWINSZ
+ struct winsize ws;
+#endif
term = getenv("TERM");
if (term==0) {
@@ -566,8 +569,17 @@ getcap()
ap = tcapbuf;
- LINES = tgetnum("li");
- COLUMNS = tgetnum("co");
+#ifdef TIOCGWINSZ
+ if (ioctl(fileno(stdout), TIOCGWINSZ, &ws) != -1 &&
+ ws.ws_col && ws.ws_row) {
+ LINES = ws.ws_row;
+ COLUMNS = ws.ws_col;
+ } else
+#endif
+ {
+ LINES = tgetnum("li");
+ COLUMNS = tgetnum("co");
+ }
if (!lcnt)
lcnt = LINES - 2;
if (!ccnt)