/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_ttyflags.c,v 1.15 2007/05/26 18:54:25 tom Exp $")
+MODULE_ID("$Id: lib_ttyflags.c,v 1.19 2009/02/15 00:33:49 tom Exp $")
NCURSES_EXPORT(int)
_nc_get_tty_mode(TTY * buf)
memset(buf, 0, sizeof(*buf));
TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s",
- cur_term->Filedes, _nc_trace_ttymode(buf)));
+ cur_term ? cur_term->Filedes : -1,
+ _nc_trace_ttymode(buf)));
}
return (result);
}
}
}
TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s",
- cur_term->Filedes, _nc_trace_ttymode(buf)));
+ cur_term ? cur_term->Filedes : -1,
+ _nc_trace_ttymode(buf)));
}
return (result);
}
NCURSES_EXPORT(int)
-def_shell_mode(void)
+NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_DCL0)
{
- T((T_CALLED("def_shell_mode()")));
+ int rc = ERR;
- /*
- * If XTABS was on, remove the tab and backtab capabilities.
- */
+ T((T_CALLED("def_shell_mode()")));
- if (_nc_get_tty_mode(&cur_term->Ottyb) != OK)
- returnCode(ERR);
+ if (cur_term != 0) {
+ /*
+ * If XTABS was on, remove the tab and backtab capabilities.
+ */
+ if (_nc_get_tty_mode(&cur_term->Ottyb) == OK) {
#ifdef TERMIOS
- if (cur_term->Ottyb.c_oflag & OFLAGS_TABS)
- tab = back_tab = NULL;
+ if (cur_term->Ottyb.c_oflag & OFLAGS_TABS)
+ tab = back_tab = NULL;
#else
- if (cur_term->Ottyb.sg_flags & XTABS)
- tab = back_tab = NULL;
+ if (cur_term->Ottyb.sg_flags & XTABS)
+ tab = back_tab = NULL;
#endif
- returnCode(OK);
+ rc = OK;
+ }
+ }
+ returnCode(rc);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-def_prog_mode(void)
+def_shell_mode(void)
{
- T((T_CALLED("def_prog_mode()")));
+ return NCURSES_SP_NAME(def_shell_mode) (CURRENT_SCREEN);
+}
+#endif
- /*
- * Turn off the XTABS bit in the tty structure if it was on.
- */
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_DCL0)
+{
+ int rc = ERR;
+
+ T((T_CALLED("def_prog_mode()")));
- if (_nc_get_tty_mode(&cur_term->Nttyb) != OK)
- returnCode(ERR);
+ if (cur_term != 0) {
+ /*
+ * Turn off the XTABS bit in the tty structure if it was on.
+ */
+ if (_nc_get_tty_mode(&cur_term->Nttyb) == OK) {
#ifdef TERMIOS
- cur_term->Nttyb.c_oflag &= ~OFLAGS_TABS;
+ cur_term->Nttyb.c_oflag &= ~OFLAGS_TABS;
#else
- cur_term->Nttyb.sg_flags &= ~XTABS;
+ cur_term->Nttyb.sg_flags &= ~XTABS;
#endif
- returnCode(OK);
+ rc = OK;
+ }
+ }
+ returnCode(rc);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-reset_prog_mode(void)
+def_prog_mode(void)
+{
+ return NCURSES_SP_NAME(def_prog_mode) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_DCL0)
{
T((T_CALLED("reset_prog_mode()")));
if (cur_term != 0) {
if (_nc_set_tty_mode(&cur_term->Nttyb) == OK) {
- if (SP) {
- if (SP->_keypad_on)
- _nc_keypad(TRUE);
+ if (SP_PARM) {
+ if (SP_PARM->_keypad_on)
+ _nc_keypad(SP_PARM, TRUE);
NC_BUFFERED(TRUE);
}
returnCode(OK);
returnCode(ERR);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-reset_shell_mode(void)
+reset_prog_mode(void)
+{
+ return NCURSES_SP_NAME(reset_prog_mode) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(reset_shell_mode) (NCURSES_SP_DCL0)
{
T((T_CALLED("reset_shell_mode()")));
if (cur_term != 0) {
- if (SP) {
- _nc_keypad(FALSE);
+ if (SP_PARM) {
+ _nc_keypad(SP_PARM, FALSE);
_nc_flush();
NC_BUFFERED(FALSE);
}
returnCode(ERR);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+reset_shell_mode(void)
+{
+ return NCURSES_SP_NAME(reset_shell_mode) (CURRENT_SCREEN);
+}
+#endif
+
static TTY *
saved_tty(void)
{