+#endif
+ }
+ _nc_unlock_global(curses);
+
+ T((T_RETURN("%p"), (void *) oldterm));
+ return (oldterm);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(TERMINAL *)
+set_curterm(TERMINAL * termp)
+{
+ return NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN, termp);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
+{
+ int rc = ERR;
+
+ T((T_CALLED("del_curterm(%p, %p)"), (void *) SP_PARM, (void *) termp));
+
+ if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) termp;
+#endif
+ TERMINAL *cur = (
+#if BROKEN_LINKER && !USE_REENTRANT
+ cur_term
+#elif BROKEN_LINKER || USE_REENTRANT
+ NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_ARG)
+#else
+ cur_term
+#endif
+ );
+
+ _nc_free_termtype(&(termp->type));
+ if (termp == cur)
+ NCURSES_SP_NAME(set_curterm) (NCURSES_SP_ARGx 0);
+
+ FreeIfNeeded(termp->_termname);
+#if USE_HOME_TERMINFO
+ if (_nc_globals.home_terminfo != 0)
+ FreeAndNull(_nc_globals.home_terminfo);
+#endif
+#ifdef USE_TERM_DRIVER
+ if (TCB->drv)
+ TCB->drv->release(TCB);
+#endif
+ free(termp);
+
+ rc = OK;
+ }
+ returnCode(rc);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+del_curterm(TERMINAL * termp)
+{
+ int rc = ERR;
+
+ _nc_lock_global(curses);
+ rc = NCURSES_SP_NAME(del_curterm) (CURRENT_SCREEN, termp);
+ _nc_unlock_global(curses);
+
+ return (rc);