- if (tgetent(mp, term) <= 0) {
- (void)fprintf(stderr, "worms: %s: unknown terminal type.\n",
- term);
- exit(1);
- }
- tcp = tcb;
- if (!(CM = tgetstr("cm", &tcp))) {
- (void)fprintf(stderr,
- "worms: terminal incapable of cursor motion.\n");
- exit(1);
- }
- AL = tgetstr("al", &tcp);
- BC = tgetflag("bs") ? "\b" : tgetstr("bc", &tcp);
- EI = tgetstr("ei", &tcp);
- HO = tgetstr("ho", &tcp);
- IC = tgetstr("ic", &tcp);
- IM = tgetstr("im", &tcp);
- IN = tgetflag("in");
- IP = tgetstr("ip", &tcp);
- SR = tgetstr("sr", &tcp);
- UP = tgetstr("up", &tcp);
-#ifdef TIOCGWINSZ
- if (ioctl(fileno(stdout), TIOCGWINSZ, &ws) != -1 &&
- ws.ws_col && ws.ws_row) {
- CO = ws.ws_col;
- LI = ws.ws_row;
- } else
-#endif
- {
- if ((CO = tgetnum("co")) <= 0)
- CO = 80;
- if ((LI = tgetnum("li")) <= 0)
- LI = 24;
- }