- if (setupterm(name, fileno(ofp), &errret) != ERR) {
- int slk_format = _nc_globals.slk_format;
+ if (
+ TINFO_SETUP_TERM(&new_term, name,
+ fileno(_ofp), &errret, FALSE) != ERR) {
+ int slk_format;
+ int filter_mode;
+
+ _nc_set_screen(0);
+#ifdef USE_TERM_DRIVER
+ assert(new_term != 0);
+#endif
+
+#if NCURSES_SP_FUNCS
+ slk_format = SP_PARM->slk_format;
+ filter_mode = SP_PARM->_filtered;
+#else
+ slk_format = _nc_globals.slk_format;
+ filter_mode = _nc_prescreen.filter_mode;
+#endif