X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_setup.c;h=90ffda762f5bbc9db8f89a85649a30a63212c032;hp=9a49ee74060c8e25eaf85b00fdc233c0740bd019;hb=6bbba9cd97d487dc567d06eb8f9131825abe3962;hpb=7a27c7d49c2e8b4a1ecbe85b4423d647cbc75ea5;ds=sidebyside diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index 9a49ee74..90ffda76 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -53,7 +53,7 @@ #include /* lines, columns, cur_term */ -MODULE_ID("$Id: lib_setup.c,v 1.98 2007/04/21 19:57:42 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.99 2007/07/16 20:32:27 tom Exp $") /**************************************************************************** * @@ -108,12 +108,12 @@ NCURSES_PUBLIC_VAR(ttytype) (void) NCURSES_EXPORT(int) NCURSES_PUBLIC_VAR(LINES) (void) { - return SP ? SP->_LINES : 0; + return (SP ? SP->_LINES : _nc_prescreen._LINES); } NCURSES_EXPORT(int) NCURSES_PUBLIC_VAR(COLS) (void) { - return SP ? SP->_COLS : 0; + return SP ? SP->_COLS : _nc_prescreen._COLS; } NCURSES_EXPORT(int) NCURSES_PUBLIC_VAR(TABSIZE) (void) @@ -564,6 +564,16 @@ _nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse) } } + /* + * We should always check the screensize, just in case. + */ +#if USE_REENTRANT + _nc_get_screensize(SP ? &(SP->_LINES) : &(_nc_prescreen._LINES), + SP ? &(SP->_COLS) : &(_nc_prescreen._COLS)); +#else + _nc_get_screensize(&LINES, &COLS); +#endif + if (errret) *errret = TGETENT_YES;