lib/libcurses/initscr.c
/*
 * initscr --
 *	Initialize the current and standard screen.
 */
initscr
Initialize the current and standard screen.
initscr Initialize the current and standard screen .
WINDOW *
initscr()
{
	register char *sp;
#ifdef DEBUG
	__CTRACE("initscr\n");
#endif
	__echoit = 1;
        __pfast = __rawmode = __noqch = 0;
	if (gettmode() == ERR)
		return (NULL);
	if (My_term || (sp = getenv("TERM")) == NULL)
		sp = Def_term;
	if (setterm(sp) == ERR)
		return (NULL);
	if (!HO && !CM) 
		return (NULL);
	if (curscr != NULL)
		delwin(curscr);
	if ((curscr = newwin(LINES, COLS, 0, 0)) == ERR)
		return (NULL);
	clearok(curscr, 1);
	if (stdscr != NULL)
		delwin(stdscr);
	if ((stdscr = newwin(LINES, COLS, 0, 0)) == ERR) {
		delwin(curscr);
		return (NULL);
	}
	__set_stophandler();
#ifdef DEBUG
	__CTRACE("initscr: LINES = %d, COLS = %d\n", LINES, COLS);
#endif
	__startwin();
	return (stdscr);
}
WINDOW * initscr ( ) { register char * sp ; #ifdef DEBUG __CTRACE ( " \n " ) ; #endif __echoit = 1 ; __pfast = __rawmode = __noqch = 0 ; if ( gettmode ( ) == ERR ) return ( NULL ) ; if ( My_term || ( sp = getenv ( " " ) ) == NULL ) sp = Def_term ; if ( setterm ( sp ) == ERR ) return ( NULL ) ; if ( ! HO && ! CM ) return ( NULL ) ; if ( curscr != NULL ) delwin ( curscr ) ; if ( ( curscr = newwin ( LINES , COLS , 0 , 0 ) ) == ERR ) return ( NULL ) ; clearok ( curscr , 1 ) ; if ( stdscr != NULL ) delwin ( stdscr ) ; if ( ( stdscr = newwin ( LINES , COLS , 0 , 0 ) ) == ERR ) { delwin ( curscr ) ; return ( NULL ) ; } __set_stophandler ( ) ; #ifdef DEBUG __CTRACE ( " \n " , LINES , COLS ) ; #endif __startwin ( ) ; return ( stdscr ) ; }
initscr
      Initialize the current and standard screen.
initscr Initialize the current and standard screen .
/*
	 * If My_term is set, or can't find a terminal in the environment,
	 * use Def_term.
	 */ /* Need either homing or cursor motion for refreshes */