Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | /**************************************************************************** |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 2 | * Copyright 2020 Thomas E. Dickey * |
| 3 | * Copyright 1998-2016,2017 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 4 | * * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a * |
| 6 | * copy of this software and associated documentation files (the * |
| 7 | * "Software"), to deal in the Software without restriction, including * |
| 8 | * without limitation the rights to use, copy, modify, merge, publish, * |
| 9 | * distribute, distribute with modifications, sublicense, and/or sell * |
| 10 | * copies of the Software, and to permit persons to whom the Software is * |
| 11 | * furnished to do so, subject to the following conditions: * |
| 12 | * * |
| 13 | * The above copyright notice and this permission notice shall be included * |
| 14 | * in all copies or substantial portions of the Software. * |
| 15 | * * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 19 | * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 20 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 21 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 22 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 23 | * * |
| 24 | * Except as contained in this notice, the name(s) of the above copyright * |
| 25 | * holders shall not be used in advertising or otherwise to promote the * |
| 26 | * sale, use or other dealings in this Software without prior written * |
| 27 | * authorization. * |
| 28 | ****************************************************************************/ |
| 29 | |
| 30 | /* |
| 31 | * def_prog_mode() |
| 32 | * def_shell_mode() |
| 33 | * reset_prog_mode() |
| 34 | * reset_shell_mode() |
| 35 | * savetty() |
| 36 | * resetty() |
| 37 | */ |
| 38 | |
| 39 | #include <curses.priv.h> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 40 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 41 | #ifndef CUR |
| 42 | #define CUR SP_TERMTYPE |
| 43 | #endif |
| 44 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 45 | MODULE_ID("$Id: lib_ttyflags.c,v 1.36 2020/09/05 22:54:47 tom Exp $") |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 46 | |
| 47 | NCURSES_EXPORT(int) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 48 | NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 49 | { |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 50 | TERMINAL *termp = TerminalOf(SP_PARM); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 51 | int result = OK; |
| 52 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 53 | if (buf == 0 || termp == 0) { |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 54 | result = ERR; |
| 55 | } else { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 56 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 57 | #ifdef USE_TERM_DRIVER |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 58 | if (SP_PARM != 0) { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 59 | result = CallDriver_2(SP_PARM, td_sgmode, FALSE, buf); |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 60 | } else { |
| 61 | result = ERR; |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 62 | } |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 63 | #else |
| 64 | for (;;) { |
| 65 | if (GET_TTY(termp->Filedes, buf) != 0) { |
| 66 | if (errno == EINTR) |
| 67 | continue; |
| 68 | result = ERR; |
| 69 | } |
| 70 | break; |
| 71 | } |
| 72 | #endif |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 73 | |
| 74 | TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s", |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 75 | termp ? termp->Filedes : -1, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 76 | _nc_trace_ttymode(buf))); |
| 77 | } |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 78 | if (result == ERR && buf != 0) |
| 79 | memset(buf, 0, sizeof(*buf)); |
| 80 | |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 81 | return (result); |
| 82 | } |
| 83 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 84 | #if NCURSES_SP_FUNCS |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 85 | NCURSES_EXPORT(int) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 86 | _nc_get_tty_mode(TTY * buf) |
| 87 | { |
| 88 | return NCURSES_SP_NAME(_nc_get_tty_mode) (CURRENT_SCREEN, buf); |
| 89 | } |
| 90 | #endif |
| 91 | |
| 92 | NCURSES_EXPORT(int) |
| 93 | NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_DCLx TTY * buf) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 94 | { |
| 95 | int result = OK; |
| 96 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 97 | if (buf == 0 || SP_PARM == 0) { |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 98 | result = ERR; |
| 99 | } else { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 100 | TERMINAL *termp = TerminalOf(SP_PARM); |
| 101 | |
| 102 | if (0 == termp) { |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 103 | result = ERR; |
| 104 | } else { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 105 | #ifdef USE_TERM_DRIVER |
| 106 | result = CallDriver_2(SP_PARM, td_sgmode, TRUE, buf); |
| 107 | #else |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 108 | for (;;) { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 109 | if ((SET_TTY(termp->Filedes, buf) != 0) |
| 110 | #if USE_KLIBC_KBD |
| 111 | && !NC_ISATTY(termp->Filedes) |
| 112 | #endif |
| 113 | ) { |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 114 | if (errno == EINTR) |
| 115 | continue; |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 116 | if ((errno == ENOTTY) && (SP_PARM != 0)) |
| 117 | SP_PARM->_notty = TRUE; |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 118 | result = ERR; |
| 119 | } |
| 120 | break; |
| 121 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 122 | #endif |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 123 | } |
| 124 | TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s", |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 125 | termp ? termp->Filedes : -1, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 126 | _nc_trace_ttymode(buf))); |
| 127 | } |
| 128 | return (result); |
| 129 | } |
| 130 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 131 | #if NCURSES_SP_FUNCS |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 132 | NCURSES_EXPORT(int) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 133 | _nc_set_tty_mode(TTY * buf) |
| 134 | { |
| 135 | return NCURSES_SP_NAME(_nc_set_tty_mode) (CURRENT_SCREEN, buf); |
| 136 | } |
| 137 | #endif |
| 138 | |
| 139 | NCURSES_EXPORT(int) |
| 140 | NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_DCL0) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 141 | { |
| 142 | int rc = ERR; |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 143 | TERMINAL *termp = TerminalOf(SP_PARM); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 144 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 145 | T((T_CALLED("def_shell_mode(%p) ->term %p"), |
| 146 | (void *) SP_PARM, (void *) termp)); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 147 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 148 | if (termp != 0) { |
| 149 | #ifdef USE_TERM_DRIVER |
| 150 | rc = CallDriver_2(SP_PARM, td_mode, FALSE, TRUE); |
| 151 | #else |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 152 | /* |
| 153 | * If XTABS was on, remove the tab and backtab capabilities. |
| 154 | */ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 155 | if (_nc_get_tty_mode(&termp->Ottyb) == OK) { |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 156 | #ifdef TERMIOS |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 157 | if (termp->Ottyb.c_oflag & OFLAGS_TABS) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 158 | tab = back_tab = NULL; |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 159 | #elif defined(EXP_WIN32_DRIVER) |
| 160 | /* noop */ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 161 | #else |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 162 | if (termp->Ottyb.sg_flags & XTABS) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 163 | tab = back_tab = NULL; |
| 164 | #endif |
| 165 | rc = OK; |
| 166 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 167 | #endif |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 168 | } |
| 169 | returnCode(rc); |
| 170 | } |
| 171 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 172 | #if NCURSES_SP_FUNCS |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 173 | NCURSES_EXPORT(int) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 174 | def_shell_mode(void) |
| 175 | { |
| 176 | return NCURSES_SP_NAME(def_shell_mode) (CURRENT_SCREEN); |
| 177 | } |
| 178 | #endif |
| 179 | |
| 180 | NCURSES_EXPORT(int) |
| 181 | NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_DCL0) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 182 | { |
| 183 | int rc = ERR; |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 184 | TERMINAL *termp = TerminalOf(SP_PARM); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 185 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 186 | T((T_CALLED("def_prog_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 187 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 188 | if (termp != 0) { |
| 189 | #ifdef USE_TERM_DRIVER |
| 190 | rc = CallDriver_2(SP_PARM, td_mode, TRUE, TRUE); |
| 191 | #else |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 192 | /* |
| 193 | * Turn off the XTABS bit in the tty structure if it was on. |
| 194 | */ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 195 | if (_nc_get_tty_mode(&termp->Nttyb) == OK) { |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 196 | #ifdef TERMIOS |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 197 | termp->Nttyb.c_oflag &= (unsigned) (~OFLAGS_TABS); |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 198 | #elif defined(EXP_WIN32_DRIVER) |
| 199 | /* noop */ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 200 | #else |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 201 | termp->Nttyb.sg_flags &= (unsigned) (~XTABS); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 202 | #endif |
| 203 | rc = OK; |
| 204 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 205 | #endif |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 206 | } |
| 207 | returnCode(rc); |
| 208 | } |
| 209 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 210 | #if NCURSES_SP_FUNCS |
| 211 | NCURSES_EXPORT(int) |
| 212 | def_prog_mode(void) |
| 213 | { |
| 214 | return NCURSES_SP_NAME(def_prog_mode) (CURRENT_SCREEN); |
| 215 | } |
| 216 | #endif |
| 217 | |
| 218 | NCURSES_EXPORT(int) |
| 219 | NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_DCL0) |
| 220 | { |
| 221 | int rc = ERR; |
| 222 | TERMINAL *termp = TerminalOf(SP_PARM); |
| 223 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 224 | T((T_CALLED("reset_prog_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 225 | |
| 226 | if (termp != 0) { |
| 227 | #ifdef USE_TERM_DRIVER |
| 228 | rc = CallDriver_2(SP_PARM, td_mode, TRUE, FALSE); |
| 229 | #else |
| 230 | if (_nc_set_tty_mode(&termp->Nttyb) == OK) { |
| 231 | if (SP_PARM) { |
| 232 | if (SP_PARM->_keypad_on) |
| 233 | _nc_keypad(SP_PARM, TRUE); |
| 234 | } |
| 235 | rc = OK; |
| 236 | } |
| 237 | #endif |
| 238 | } |
| 239 | returnCode(rc); |
| 240 | } |
| 241 | |
| 242 | #if NCURSES_SP_FUNCS |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 243 | NCURSES_EXPORT(int) |
| 244 | reset_prog_mode(void) |
| 245 | { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 246 | return NCURSES_SP_NAME(reset_prog_mode) (CURRENT_SCREEN); |
| 247 | } |
| 248 | #endif |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 249 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 250 | NCURSES_EXPORT(int) |
| 251 | NCURSES_SP_NAME(reset_shell_mode) (NCURSES_SP_DCL0) |
| 252 | { |
| 253 | int rc = ERR; |
| 254 | TERMINAL *termp = TerminalOf(SP_PARM); |
| 255 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 256 | T((T_CALLED("reset_shell_mode(%p) ->term %p"), |
| 257 | (void *) SP_PARM, (void *) termp)); |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 258 | |
| 259 | if (termp != 0) { |
| 260 | #ifdef USE_TERM_DRIVER |
| 261 | rc = CallDriver_2(SP_PARM, td_mode, FALSE, FALSE); |
| 262 | #else |
| 263 | if (SP_PARM) { |
| 264 | _nc_keypad(SP_PARM, FALSE); |
| 265 | _nc_flush(); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 266 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 267 | rc = _nc_set_tty_mode(&termp->Ottyb); |
| 268 | #endif |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 269 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 270 | returnCode(rc); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 271 | } |
| 272 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 273 | #if NCURSES_SP_FUNCS |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 274 | NCURSES_EXPORT(int) |
| 275 | reset_shell_mode(void) |
| 276 | { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 277 | return NCURSES_SP_NAME(reset_shell_mode) (CURRENT_SCREEN); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 278 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 279 | #endif |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 280 | |
| 281 | static TTY * |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 282 | saved_tty(NCURSES_SP_DCL0) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 283 | { |
| 284 | TTY *result = 0; |
| 285 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 286 | if (SP_PARM != 0) { |
| 287 | result = (TTY *) & (SP_PARM->_saved_tty); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 288 | } else { |
| 289 | if (_nc_prescreen.saved_tty == 0) { |
| 290 | _nc_prescreen.saved_tty = typeCalloc(TTY, 1); |
| 291 | } |
| 292 | result = _nc_prescreen.saved_tty; |
| 293 | } |
| 294 | return result; |
| 295 | } |
| 296 | |
| 297 | /* |
| 298 | ** savetty() and resetty() |
| 299 | ** |
| 300 | */ |
| 301 | |
| 302 | NCURSES_EXPORT(int) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 303 | NCURSES_SP_NAME(savetty) (NCURSES_SP_DCL0) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 304 | { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 305 | T((T_CALLED("savetty(%p)"), (void *) SP_PARM)); |
| 306 | returnCode(NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_ARGx saved_tty(NCURSES_SP_ARG))); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 307 | } |
| 308 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 309 | #if NCURSES_SP_FUNCS |
| 310 | NCURSES_EXPORT(int) |
| 311 | savetty(void) |
| 312 | { |
| 313 | return NCURSES_SP_NAME(savetty) (CURRENT_SCREEN); |
| 314 | } |
| 315 | #endif |
| 316 | |
| 317 | NCURSES_EXPORT(int) |
| 318 | NCURSES_SP_NAME(resetty) (NCURSES_SP_DCL0) |
| 319 | { |
| 320 | T((T_CALLED("resetty(%p)"), (void *) SP_PARM)); |
| 321 | returnCode(NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx saved_tty(NCURSES_SP_ARG))); |
| 322 | } |
| 323 | |
| 324 | #if NCURSES_SP_FUNCS |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 325 | NCURSES_EXPORT(int) |
| 326 | resetty(void) |
| 327 | { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 328 | return NCURSES_SP_NAME(resetty) (CURRENT_SCREEN); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 329 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 330 | #endif |