-/* $NetBSD: screen.c,v 1.8 1999/01/03 02:00:18 hubertf Exp $ */
+/* $NetBSD: screen.c,v 1.16 2001/11/02 18:27:00 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
static void (*tstp) __P((int));
static void scr_stop __P((int));
-static void stopset __P((int));
+static void stopset __P((int)) __attribute__((__noreturn__));
/*
* Capabilities from TERMCAP.
*/
-char PC, *BC, *UP; /* tgoto requires globals: ugh! */
-speed_t ospeed;
+short ospeed;
static char
*bcstr, /* backspace char */
/* 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));
}
/*
* 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.
#ifdef unneeded
static int ncflag;
#endif
- char *term, *fill;
+ char *term;
static struct tcninfo { /* termcap numeric and flag info */
char tcname[3];
int *tcaddr;
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";
void
stop(why)
- char *why;
+ const char *why;
{
if (isset)
register regcell so, cur_so = 0;
register int i, ccol, j;
sigset_t sigset, osigset;
- static struct shape *lastshape;
+ static const struct shape *lastshape;
sigemptyset(&sigset);
sigaddset(&sigset, SIGTSTP);
curscore = score;
}
-#ifndef NO_PREVIEW
/* draw preview of nextpattern */
- if (nextshape != lastshape) {
+ if (showpreview && (nextshape != lastshape)) {
int i;
static int r=5, c=2;
int tr, tc, t;
}
putpad(SEstr);
}
-#endif
bp = &board[D_FIRST * B_COLS];
sp = &curscreen[D_FIRST * B_COLS];