X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_setup.c;h=04ce4e465f32c4dab2cfecfa15c4eb96b0a3d95e;hp=04acfb496e972cc65d65e5b1bbf54012cd3e35f4;hb=119b5a6788c26bf7dcc99fcfd54e072946352a93;hpb=97df2f335617625b7355c04e46175e316ef02544 diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index 04acfb49..04ce4e46 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -48,7 +48,7 @@ #include #endif -MODULE_ID("$Id: lib_setup.c,v 1.202 2019/07/28 19:33:40 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.206 2019/11/03 00:07:45 tom Exp $") /**************************************************************************** * @@ -173,16 +173,20 @@ NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (NCURSES_SP_DCLx int value) { int code = OK; -#if USE_REENTRANT - if (SP_PARM) { - SP_PARM->_TABSIZE = value; - } else { + if (value <= 0) { code = ERR; - } + } else { +#if USE_REENTRANT + if (SP_PARM) { + SP_PARM->_TABSIZE = value; + } else { + code = ERR; + } #else - (void) SP_PARM; - TABSIZE = value; + (void) SP_PARM; + TABSIZE = value; #endif + } return code; } @@ -446,23 +450,24 @@ _nc_update_screensize(SCREEN *sp) int old_cols = columns; #endif - TINFO_GET_SIZE(sp, sp->_term, &new_lines, &new_cols); - - /* - * See is_term_resized() and resizeterm(). - * We're doing it this way because those functions belong to the upper - * ncurses library, while this resides in the lower terminfo library. - */ - if (sp != 0 && sp->_resize != 0) { - if ((new_lines != old_lines) || (new_cols != old_cols)) { - sp->_resize(NCURSES_SP_ARGx new_lines, new_cols); - } else if (sp->_sig_winch && (sp->_ungetch != 0)) { - sp->_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ + if (sp != 0) { + TINFO_GET_SIZE(sp, sp->_term, &new_lines, &new_cols); + /* + * See is_term_resized() and resizeterm(). + * We're doing it this way because those functions belong to the upper + * ncurses library, while this resides in the lower terminfo library. + */ + if (sp->_resize != 0) { + if ((new_lines != old_lines) || (new_cols != old_cols)) { + sp->_resize(NCURSES_SP_ARGx new_lines, new_cols); + } else if (sp->_sig_winch && (sp->_ungetch != 0)) { + sp->_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ + } + sp->_sig_winch = FALSE; } - sp->_sig_winch = FALSE; } } -#endif +#endif /* USE_SIZECHANGE */ /**************************************************************************** * @@ -776,6 +781,8 @@ TINFO_SETUP_TERM(TERMINAL **tp, } else if (status == TGETENT_NO) { ret_error1(status, "unknown terminal type.\n", myname, free(myname)); + } else { + ret_error0(status, "unexpected return-code\n"); } } #if NCURSES_EXT_NUMBERS