+/*
+ * Reduce explicit use of "cur_term" global variable.
+ */
+#undef CUR
+#define CUR termp->type.
+
+/*
+ * Wrap global variables in this module.
+ */
+#if USE_REENTRANT
+NCURSES_EXPORT(char *)
+NCURSES_PUBLIC_VAR(ttytype) (void)
+{
+ static char empty[] = "";
+ return cur_term ? cur_term->type.term_names : empty;
+}
+NCURSES_EXPORT(int *)
+_nc_ptr_Lines(SCREEN *sp)
+{
+ return ptrLines(sp);
+}
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(LINES) (void)
+{
+ return *_nc_ptr_Lines(CURRENT_SCREEN);
+}
+NCURSES_EXPORT(int *)
+_nc_ptr_Cols(SCREEN *sp)
+{
+ return ptrCols(sp);
+}
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(COLS) (void)
+{
+ return *_nc_ptr_Cols(CURRENT_SCREEN);
+}
+NCURSES_EXPORT(int *)
+_nc_ptr_Tabsize(SCREEN *sp)
+{
+ return ptrTabsize(sp);
+}
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(TABSIZE) (void)
+{
+ return *_nc_ptr_Tabsize(CURRENT_SCREEN);
+}
+#else
+NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = "";
+NCURSES_EXPORT_VAR(int) LINES = 0;
+NCURSES_EXPORT_VAR(int) COLS = 0;
+NCURSES_EXPORT_VAR(int) TABSIZE = 8;
+#endif
+
+#if NCURSES_EXT_FUNCS
+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 {
+ code = ERR;
+ }
+#else
+ (void) SP_PARM;
+ TABSIZE = value;
+#endif
+ return code;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+set_tabsize(int value)
+{
+ return NCURSES_SP_NAME(set_tabsize) (CURRENT_SCREEN, value);
+}
+#endif
+#endif /* NCURSES_EXT_FUNCS */
+
+#if USE_SIGWINCH
+/*
+ * If we have a pending SIGWINCH, set the flag in each screen.
+ */
+NCURSES_EXPORT(int)
+_nc_handle_sigwinch(SCREEN *sp)
+{
+ SCREEN *scan;
+
+ if (_nc_globals.have_sigwinch) {
+ _nc_globals.have_sigwinch = 0;
+
+ for (each_screen(scan)) {
+ scan->_sig_winch = TRUE;
+ }
+ }