#ifndef lint
static char
sccsid[] = "@(#)initscr.c 1.6 88/02/08 SMI";
#endif
#include "curses.ext"
#include <term.h>
#include <stdlib.h>
#include <signal.h>
WINDOW *
initscr(void)
{
char *sp;
#ifdef DEBUG
fprintf(outf, "INITSCR()\n");
#endif
if (My_term)
(void) setterm(Def_term);
else {
(void) gettmode();
if ((sp = getenv("TERM")) == NULL)
sp = Def_term;
(void) setterm(sp);
#ifdef DEBUG
fprintf(outf, "INITSCR: term = %s\n", sp);
#endif
}
(void) _puts(TI);
(void) _puts(VS);
#ifdef SIGTSTP
(void) signal(SIGTSTP, (void(*)(int))tstp);
#endif
if (curscr != NULL) {
#ifdef DEBUG
fprintf(outf, "INITSCR: curscr = 0%o\n", curscr);
#endif
(void) delwin(curscr);
}
#ifdef DEBUG
fprintf(outf, "LINES = %d, COLS = %d\n", LINES, COLS);
#endif
if ((curscr = newwin(LINES, COLS, 0, 0)) == ERR)
return (ERR);
clearok(curscr, TRUE);
curscr->_flags &= ~_FULLLINE;
if (stdscr != NULL) {
#ifdef DEBUG
fprintf(outf, "INITSCR: stdscr = 0%o\n", stdscr);
#endif
(void) delwin(stdscr);
}
stdscr = newwin(LINES, COLS, 0, 0);
return (stdscr);
}