2 /***************************************************************************
4 ****************************************************************************
5 * ncurses is copyright (C) 1992-1995 *
7 * zmbenhal@netcom.com *
9 * esr@snark.thyrsus.com *
11 * Permission is hereby granted to reproduce and distribute ncurses *
12 * by any means and for any fee, whether alone or as part of a *
13 * larger distribution, in source or in binary form, PROVIDED *
14 * this notice is included with any such distribution, and is not *
15 * removed from any of its header files. Mention of ncurses in any *
16 * applications linked with it is highly appreciated. *
18 * ncurses comes AS IS with no warranty, implied or expressed. *
20 ***************************************************************************/
23 * Terminfo-only terminal setup routines:
25 * int restartterm(const char *, int, int *)
26 * TERMINAL *set_curterm(TERMINAL *)
27 * int del_curterm(TERMINAL *)
30 #include <curses.priv.h>
36 #include <term.h> /* lines, columns, cur_term */
38 MODULE_ID("$Id: lib_restart.c,v 1.11 1997/02/02 01:10:25 tom Exp $")
56 int def_shell_mode(void)
58 T((T_CALLED("def_shell_mode()")));
64 * Turn off the XTABS bit in the tty structure if it was on. If XTABS
65 * was on, remove the tab and backtab capabilities.
68 if (GET_TTY(cur_term->Filedes, &cur_term->Ottyb) == -1)
71 if (cur_term->Ottyb.c_oflag & tabs)
72 tab = back_tab = NULL;
74 if (cur_term->Ottyb.sg_flags & XTABS)
75 tab = back_tab = NULL;
80 int def_prog_mode(void)
82 T((T_CALLED("def_prog_mode()")));
87 if (GET_TTY(cur_term->Filedes, &cur_term->Nttyb) == -1)
90 cur_term->Nttyb.c_oflag &= ~tabs;
92 cur_term->Nttyb.sg_flags &= ~XTABS;
97 int restartterm(const char *term, int filenum, int *errret)
99 int saveecho = SP->_echo;
100 int savecbreak = SP->_cbreak;
101 int saveraw = SP->_raw;
102 int savenl = SP->_nl;
104 T((T_CALLED("restartterm(%s,%d,%p)"), term, filenum, errret));
106 setupterm(term, filenum, errret);
116 } else if (saveraw) {
130 _nc_get_screensize();
135 TERMINAL *set_curterm(TERMINAL *term)
137 TERMINAL *oldterm = cur_term;
143 int del_curterm(TERMINAL *term)
145 T((T_CALLED("del_curterm(%p)"), term));
148 FreeIfNeeded(term->type.str_table);
149 FreeIfNeeded(term->type.term_names);