+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_DCLx TTY * buf)
+{
+ int result = OK;
+
+ if (buf == 0) {
+ result = ERR;
+ } else {
+ if (cur_term == 0) {
+ result = ERR;
+ } else {
+ for (;;) {
+ if (SET_TTY(cur_term->Filedes, buf) != 0) {
+ if (errno == EINTR)
+ continue;
+ if ((errno == ENOTTY) && (SP_PARM != 0))
+ SP_PARM->_notty = TRUE;
+ result = ERR;
+ }
+ break;
+ }
+ }
+ TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s",
+ cur_term ? cur_term->Filedes : -1,
+ _nc_trace_ttymode(buf)));
+ }
+ return (result);
+}
+
+#if NCURSES_SP_FUNCS