diff options
author | blymn <blymn@NetBSD.org> | 2000-05-22 12:42:46 +0000 |
---|---|---|
committer | blymn <blymn@NetBSD.org> | 2000-05-22 12:42:46 +0000 |
commit | a2987258cb8a1c5cfe9ab775230b1513a4df6471 (patch) | |
tree | 43bac01c52b99ed7102c4f607ae581bd3b362d8f /tetris | |
parent | 72c340b256dc83ba3536b8ba39d22f7890312221 (diff) | |
download | bsdgames-darwin-a2987258cb8a1c5cfe9ab775230b1513a4df6471.tar.gz bsdgames-darwin-a2987258cb8a1c5cfe9ab775230b1513a4df6471.tar.zst bsdgames-darwin-a2987258cb8a1c5cfe9ab775230b1513a4df6471.zip |
Converted games to use the new termcap interface.
Diffstat (limited to 'tetris')
-rw-r--r-- | tetris/screen.c | 28 | ||||
-rw-r--r-- | tetris/screen.h | 3 |
2 files changed, 20 insertions, 11 deletions
diff --git a/tetris/screen.c b/tetris/screen.c index 194c4f2f..4b88db80 100644 --- a/tetris/screen.c +++ b/tetris/screen.c @@ -1,4 +1,4 @@ -/* $NetBSD: screen.c,v 1.13 1999/10/04 23:27:03 lukem Exp $ */ +/* $NetBSD: screen.c,v 1.14 2000/05/22 12:42:47 blymn Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -73,7 +73,6 @@ static void stopset __P((int)) __attribute__((__noreturn__)); /* * Capabilities from TERMCAP. */ -char PC, *BC, *UP; /* tgoto requires globals: ugh! */ short ospeed; static char @@ -121,8 +120,8 @@ struct tcsinfo { /* termcap string info; some abbrevs above */ /* This is where we will actually stuff the information */ -static char combuf[1024], tbuf[1024]; - +static char *combuf; +static struct tinfo *info; /* * Routine used by tputs(). @@ -141,7 +140,15 @@ put(c) * count=1. (See screen.h for putpad().) */ #define putstr(s) (void)fputs(s, stdout) -#define moveto(r, c) putpad(tgoto(CMstr, c, r)) + +void +moveto(int r, int c) +{ + char buf[256]; + + if (t_goto(info, CMstr, c, r, buf, 255) == 0) + putpad(buf); +} /* * Set up from termcap. @@ -174,22 +181,23 @@ scr_init() if ((term = getenv("TERM")) == NULL) stop("you must set the TERM environment variable"); - if (tgetent(tbuf, term) <= 0) + if (t_getent(&info, term) <= 0) stop("cannot find your termcap"); - fill = combuf; + *combuf = NULL; { register struct tcsinfo *p; for (p = tcstrings; p->tcaddr; p++) - *p->tcaddr = tgetstr(p->tcname, &fill); + *p->tcaddr = t_agetstr(info, p->tcname, &combuf, + &fill); } { register struct tcninfo *p; for (p = tcflags; p->tcaddr; p++) - *p->tcaddr = tgetflag(p->tcname); + *p->tcaddr = t_getflag(info, p->tcname); for (p = tcnums; p->tcaddr; p++) - *p->tcaddr = tgetnum(p->tcname); + *p->tcaddr = t_getnum(info, p->tcname); } if (bsflag) BC = "\b"; diff --git a/tetris/screen.h b/tetris/screen.h index 0b12171a..d1b793f3 100644 --- a/tetris/screen.h +++ b/tetris/screen.h @@ -1,4 +1,4 @@ -/* $NetBSD: screen.h,v 1.5 2000/01/01 10:15:17 jsm Exp $ */ +/* $NetBSD: screen.h,v 1.6 2000/05/22 12:42:48 blymn Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -49,6 +49,7 @@ extern char *SOstr; /* begin standout mode */ */ #define putpad(s) tputs(s, 1, put) +void moveto(int, int); int put __P((int)); /* just calls putchar; for tputs */ void scr_clear __P((void)); void scr_end __P((void)); |