/* * Copyright (c) 1981 Regents of the University of California. * All rights reserved. * * %sccs.include.redist.c% */ #ifndef lint static char sccsid[] = "@(#)initscr.c 5.6 (Berkeley) 03/03/91"; #endif /* not lint */ # include "curses.ext" # include extern char *getenv(); /* * This routine initializes the current and standard screen. * */ WINDOW * initscr() { reg char *sp; void tstp(); # ifdef DEBUG fprintf(outf, "INITSCR()\n"); # endif if (My_term) setterm(Def_term); else { gettmode(); if ((sp = getenv("TERM")) == NULL) sp = Def_term; setterm(sp); # ifdef DEBUG fprintf(outf, "INITSCR: term = %s\n", sp); # endif } _puts(TI); _puts(VS); # ifdef SIGTSTP signal(SIGTSTP, tstp); # endif if (curscr != NULL) { # ifdef DEBUG fprintf(outf, "INITSCR: curscr = 0%o\n", curscr); # endif 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 delwin(stdscr); } stdscr = newwin(LINES, COLS, 0, 0); return stdscr; }