X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/82852318e37fa7eddacc3dd162a2d16d3a7487b9..026158ce21511a76693e38921c011f2f2fa66002:/tetris/screen.c diff --git a/tetris/screen.c b/tetris/screen.c index f27fb552..49031645 100644 --- a/tetris/screen.c +++ b/tetris/screen.c @@ -1,4 +1,4 @@ -/* $NetBSD: screen.c,v 1.12 1999/09/08 21:45:31 jsm Exp $ */ +/* $NetBSD: screen.c,v 1.16 2001/11/02 18:27:00 christos 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,18 +120,17 @@ struct tcsinfo { /* termcap string info; some abbrevs above */ /* This is where we will actually stuff the information */ -static char combuf[1024], tbuf[1024]; - +static struct tinfo *info; /* * Routine used by tputs(). */ -void +int put(c) int c; { - (void) putchar(c); + return (putchar(c)); } /* @@ -141,7 +139,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. @@ -153,7 +159,7 @@ scr_init() #ifdef unneeded static int ncflag; #endif - char *term, *fill; + char *term; static struct tcninfo { /* termcap numeric and flag info */ char tcname[3]; int *tcaddr; @@ -174,22 +180,21 @@ 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; { register struct tcsinfo *p; for (p = tcstrings; p->tcaddr; p++) - *p->tcaddr = tgetstr(p->tcname, &fill); + *p->tcaddr = t_agetstr(info, p->tcname); } { 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";