#include <locale.h>
#endif
-MODULE_ID("$Id: lib_setup.c,v 1.200 2019/06/22 00:15:32 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.204 2019/08/10 17:08:00 tom Exp $")
/****************************************************************************
*
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 */
/****************************************************************************
*
if (strlen(myname) > MAX_NAME_SIZE) {
ret_error(TGETENT_ERR,
"TERM environment must be <= %d characters.\n",
- MAX_NAME_SIZE);
+ MAX_NAME_SIZE,
+ free(myname));
}
T(("your terminal name is %s", myname));
termp = typeCalloc(TERMINAL, 1);
#endif
if (termp == 0) {
- ret_error0(TGETENT_ERR,
- "Not enough memory to create terminal structure.\n");
+ ret_error1(TGETENT_ERR,
+ "Not enough memory to create terminal structure.\n",
+ myname, free(myname));
}
#if HAVE_SYSCONF
{
termp->Filedes = (short) Filedes;
termp->_termname = strdup(myname);
} else {
- ret_error0(errret ? *errret : TGETENT_ERR,
- "Could not find any driver to handle this terminal.\n");
+ ret_error1(errret ? *errret : TGETENT_ERR,
+ "Could not find any driver to handle terminal.\n",
+ myname, free(myname));
}
#else
#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP
if (status != TGETENT_YES) {
del_curterm(termp);
if (status == TGETENT_ERR) {
+ free(myname);
ret_error0(status, "terminals database is inaccessible\n");
} else if (status == TGETENT_NO) {
- ret_error1(status, "unknown terminal type.\n", myname);
+ ret_error1(status, "unknown terminal type.\n",
+ myname, free(myname));
+ } else {
+ ret_error0(status, "unexpected return-code\n");
}
}
#if NCURSES_EXT_NUMBERS
if ((VALID_STRING(cursor_address)
|| (VALID_STRING(cursor_down) && VALID_STRING(cursor_home)))
&& VALID_STRING(clear_screen)) {
- ret_error1(TGETENT_YES, "terminal is not really generic.\n", myname);
+ ret_error1(TGETENT_YES, "terminal is not really generic.\n",
+ myname, free(myname));
} else {
del_curterm(termp);
- ret_error1(TGETENT_NO, "I need something more specific.\n", myname);
+ ret_error1(TGETENT_NO, "I need something more specific.\n",
+ myname, free(myname));
}
} else if (hard_copy) {
- ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n", myname);
+ ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n",
+ myname, free(myname));
}
#endif
free(myname);