/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <locale.h>
#endif
-MODULE_ID("$Id: lib_setup.c,v 1.149 2012/09/03 16:19:14 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.158 2013/06/22 19:59:08 tom Exp $")
/****************************************************************************
*
* 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 (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)) {
*
****************************************************************************/
-#if USE_DATABASE || USE_TERMCAP
+#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP
/*
* Return 1 if entry found, 0 if not found, -1 if database not accessible,
* just like tgetent().
if (tname == 0) {
tname = getenv("TERM");
if (tname == 0 || *tname == '\0') {
+#ifdef USE_TERM_DRIVER
+ tname = "unknown";
+#else
ret_error0(TGETENT_ERR, "TERM environment variable not set.\n");
+#endif
}
}
&& _nc_name_match(termp->type.term_names, tname, "|")) {
T(("reusing existing terminal information and mode-settings"));
code = OK;
+#ifdef USE_TERM_DRIVER
+ TCB = (TERMINAL_CONTROL_BLOCK *) termp;
+#endif
} else {
#ifdef USE_TERM_DRIVER
- termp = (TERMINAL *) typeCalloc(TERMINAL_CONTROL_BLOCK, 1);
+ TERMINAL_CONTROL_BLOCK *my_tcb;
+ my_tcb = typeCalloc(TERMINAL_CONTROL_BLOCK, 1);
+ termp = &(my_tcb->term);
#else
termp = typeCalloc(TERMINAL, 1);
#endif
"Could not find any driver to handle this terminal.\n");
}
#else
-#if USE_DATABASE || USE_TERMCAP
+#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP
status = _nc_setup_tinfo(tname, &termp->type);
#else
status = TGETENT_NO;
&& VALID_STRING(clear_screen)) {
ret_error1(TGETENT_YES, "terminal is not really generic.\n", tname);
} else {
+ del_curterm(termp);
ret_error1(TGETENT_NO, "I need something more specific.\n", tname);
}
} else if (hard_copy) {
int reuse)
{
int res;
- TERMINAL *termp;
+ TERMINAL *termp = 0;
res = TINFO_SETUP_TERM(&termp, tname, Filedes, errret, reuse);
if (ERR != res)
NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN_PRE, termp);