Fix for systems that don't have TCSASOFT as intended originally. Simplify.
This commit is contained in:
parent
4384aaccea
commit
ef87b14708
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tstp.c,v 1.38 2010/02/03 15:34:40 roy Exp $ */
|
||||
/* $NetBSD: tstp.c,v 1.39 2011/08/29 11:07:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tstp.c 8.3 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: tstp.c,v 1.38 2010/02/03 15:34:40 roy Exp $");
|
||||
__RCSID("$NetBSD: tstp.c,v 1.39 2011/08/29 11:07:38 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -55,6 +55,9 @@ static void (*otstpfn)
|
|||
__P((int)) = SIG_DFL;
|
||||
|
||||
static struct sigaction owsa;
|
||||
#ifndef TCSASOFT
|
||||
#define TCSASOFT 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* stop_signal_handler --
|
||||
|
@ -243,9 +246,8 @@ __stopwin(void)
|
|||
|
||||
_cursesi_screen->endwin = 1;
|
||||
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd),
|
||||
__tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
&_cursesi_screen->orig_termios) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
&_cursesi_screen->orig_termios) ? ERR : OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -299,9 +301,8 @@ __restartwin(void)
|
|||
&_cursesi_screen->orig_termios);
|
||||
|
||||
/* Reset the terminal state to the mode just before we stopped. */
|
||||
(void) tcsetattr(fileno(_cursesi_screen->infd),
|
||||
__tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
&_cursesi_screen->save_termios);
|
||||
(void) tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
&_cursesi_screen->save_termios);
|
||||
|
||||
/* Restore colours */
|
||||
__restore_colors();
|
||||
|
@ -325,28 +326,27 @@ def_prog_mode(void)
|
|||
if (_cursesi_screen->endwin)
|
||||
return ERR;
|
||||
|
||||
return (tcgetattr(fileno(_cursesi_screen->infd),
|
||||
&_cursesi_screen->save_termios) ? ERR : OK);
|
||||
return tcgetattr(fileno(_cursesi_screen->infd),
|
||||
&_cursesi_screen->save_termios) ? ERR : OK;
|
||||
}
|
||||
|
||||
int
|
||||
reset_prog_mode(void)
|
||||
{
|
||||
|
||||
return tcsetattr(fileno(_cursesi_screen->infd),
|
||||
__tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
&_cursesi_screen->save_termios) ? ERR : OK;
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
&_cursesi_screen->save_termios) ? ERR : OK;
|
||||
}
|
||||
|
||||
int
|
||||
def_shell_mode(void)
|
||||
{
|
||||
return (tcgetattr(fileno(_cursesi_screen->infd),
|
||||
&_cursesi_screen->orig_termios) ? ERR : OK);
|
||||
return tcgetattr(fileno(_cursesi_screen->infd),
|
||||
&_cursesi_screen->orig_termios) ? ERR : OK;
|
||||
}
|
||||
|
||||
int
|
||||
reset_shell_mode(void)
|
||||
{
|
||||
return (__stopwin());
|
||||
return __stopwin();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tty.c,v 1.42 2010/02/03 15:34:40 roy Exp $ */
|
||||
/* $NetBSD: tty.c,v 1.43 2011/08/29 11:07:38 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tty.c 8.6 (Berkeley) 1/10/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: tty.c,v 1.42 2010/02/03 15:34:40 roy Exp $");
|
||||
__RCSID("$NetBSD: tty.c,v 1.43 2011/08/29 11:07:38 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -56,12 +56,12 @@ __RCSID("$NetBSD: tty.c,v 1.42 2010/02/03 15:34:40 roy Exp $");
|
|||
* those attributes at each change, or at least when stopped and restarted.
|
||||
* See also the comments in getterm().
|
||||
*/
|
||||
#ifdef TCSASOFT
|
||||
int __tcaction = 1; /* Ignore hardware settings. */
|
||||
#else
|
||||
int __tcaction = 0;
|
||||
#ifndef TCSASOFT
|
||||
#define TCSASOFT 0
|
||||
#endif
|
||||
|
||||
int __tcaction = TCSASOFT != 0; /* Ignore hardware settings */
|
||||
|
||||
#ifndef OXTABS
|
||||
#ifdef XTABS /* SMI uses XTABS. */
|
||||
#define OXTABS XTABS
|
||||
|
@ -115,7 +115,7 @@ _cursesi_gettmode(SCREEN *screen)
|
|||
screen->notty = TRUE;
|
||||
__GT = 0;
|
||||
__NONL = 0;
|
||||
return (OK);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,7 @@ _cursesi_gettmode(SCREEN *screen)
|
|||
screen->rawt.c_oflag &= ~OPOST;
|
||||
screen->rawt.c_lflag &= ~(ISIG | IEXTEN);
|
||||
|
||||
#if TCSASOFT == 0
|
||||
/*
|
||||
* In general, curses should leave hardware-related settings alone.
|
||||
* This includes parity and word size. Older versions set the tty
|
||||
|
@ -151,15 +152,14 @@ _cursesi_gettmode(SCREEN *screen)
|
|||
* parity and word size, the TCSASOFT bit has to be removed from the
|
||||
* calls that switch to/from "raw" mode.
|
||||
*/
|
||||
if (!__tcaction) {
|
||||
screen->rawt.c_iflag &= ~ISTRIP;
|
||||
screen->rawt.c_cflag &= ~(CSIZE | PARENB);
|
||||
screen->rawt.c_cflag |= CS8;
|
||||
}
|
||||
screen->rawt.c_iflag &= ~ISTRIP;
|
||||
screen->rawt.c_cflag &= ~(CSIZE | PARENB);
|
||||
screen->rawt.c_cflag |= CS8;
|
||||
#endif
|
||||
|
||||
screen->curt = &screen->baset;
|
||||
return (tcsetattr(fileno(screen->infd), __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN, screen->curt) ? ERR : OK);
|
||||
return tcsetattr(fileno(screen->infd), TCSASOFT | TCSADRAIN,
|
||||
screen->curt) ? ERR : OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -180,9 +180,8 @@ raw(void)
|
|||
_cursesi_screen->curt = &_cursesi_screen->rawt;
|
||||
if (_cursesi_screen->notty == TRUE)
|
||||
return OK;
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -203,9 +202,8 @@ noraw(void)
|
|||
if (_cursesi_screen->notty == TRUE)
|
||||
return OK;
|
||||
_cursesi_screen->curt = &_cursesi_screen->baset;
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -227,9 +225,8 @@ cbreak(void)
|
|||
return OK;
|
||||
_cursesi_screen->curt = _cursesi_screen->useraw ?
|
||||
&_cursesi_screen->rawt : &_cursesi_screen->cbreakt;
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -257,9 +254,8 @@ nocbreak(void)
|
|||
_cursesi_screen->half_delay = FALSE;
|
||||
_cursesi_screen->curt = _cursesi_screen->useraw ?
|
||||
&_cursesi_screen->rawt : &_cursesi_screen->baset;
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -302,8 +298,8 @@ __delay(void)
|
|||
_cursesi_screen->baset.c_cc[VMIN] = 1;
|
||||
_cursesi_screen->baset.c_cc[VTIME] = 0;
|
||||
|
||||
if (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT : TCSANOW, _cursesi_screen->curt)) {
|
||||
if (tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSANOW,
|
||||
_cursesi_screen->curt)) {
|
||||
__restore_termios();
|
||||
return ERR;
|
||||
}
|
||||
|
@ -330,8 +326,8 @@ __nodelay(void)
|
|||
_cursesi_screen->baset.c_cc[VMIN] = 0;
|
||||
_cursesi_screen->baset.c_cc[VTIME] = 0;
|
||||
|
||||
if (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT : TCSANOW, _cursesi_screen->curt)) {
|
||||
if (tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSANOW,
|
||||
_cursesi_screen->curt)) {
|
||||
__restore_termios();
|
||||
return ERR;
|
||||
}
|
||||
|
@ -390,9 +386,8 @@ __timeout(int delay)
|
|||
_cursesi_screen->baset.c_cc[VMIN] = 0;
|
||||
_cursesi_screen->baset.c_cc[VTIME] = delay;
|
||||
|
||||
if (tcsetattr(fileno(_cursesi_screen->infd),
|
||||
__tcaction ? TCSASOFT | TCSANOW : TCSANOW,
|
||||
_cursesi_screen->curt)) {
|
||||
if (tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSANOW,
|
||||
_cursesi_screen->curt)) {
|
||||
__restore_termios();
|
||||
return ERR;
|
||||
}
|
||||
|
@ -419,9 +414,8 @@ __notimeout(void)
|
|||
_cursesi_screen->baset.c_cc[VMIN] = 1;
|
||||
_cursesi_screen->baset.c_cc[VTIME] = 0;
|
||||
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd),
|
||||
__tcaction ? TCSASOFT | TCSANOW : TCSANOW,
|
||||
_cursesi_screen->curt) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSANOW,
|
||||
_cursesi_screen->curt) ? ERR : OK;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -435,7 +429,7 @@ echo(void)
|
|||
__restartwin();
|
||||
|
||||
__echoit = 1;
|
||||
return (OK);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -449,7 +443,7 @@ noecho(void)
|
|||
__restartwin();
|
||||
|
||||
__echoit = 0;
|
||||
return (OK);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -473,9 +467,8 @@ nl(void)
|
|||
|
||||
_cursesi_screen->nl = 1;
|
||||
_cursesi_screen->pfast = _cursesi_screen->rawmode;
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -499,9 +492,8 @@ nonl(void)
|
|||
|
||||
_cursesi_screen->nl = 0;
|
||||
__pfast = 1;
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK;
|
||||
}
|
||||
|
||||
#ifndef _CURSES_USE_MACROS
|
||||
|
@ -538,9 +530,8 @@ intrflush(WINDOW *win, bool bf) /*ARGSUSED*/
|
|||
}
|
||||
|
||||
__pfast = 1;
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
_cursesi_screen->curt) ? ERR : OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -587,14 +578,14 @@ endwin(void)
|
|||
bool
|
||||
isendwin(void)
|
||||
{
|
||||
return (_cursesi_screen->endwin ? TRUE : FALSE);
|
||||
return _cursesi_screen->endwin ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
flushinp(void)
|
||||
{
|
||||
(void) fpurge(_cursesi_screen->infd);
|
||||
return (OK);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -608,8 +599,8 @@ savetty(void)
|
|||
{
|
||||
if (_cursesi_screen->notty == TRUE)
|
||||
return OK;
|
||||
return (tcgetattr(fileno(_cursesi_screen->infd),
|
||||
&_cursesi_screen->savedtty) ? ERR : OK);
|
||||
return tcgetattr(fileno(_cursesi_screen->infd),
|
||||
&_cursesi_screen->savedtty) ? ERR : OK;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -617,9 +608,8 @@ resetty(void)
|
|||
{
|
||||
if (_cursesi_screen->notty == TRUE)
|
||||
return OK;
|
||||
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN,
|
||||
&_cursesi_screen->savedtty) ? ERR : OK);
|
||||
return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN,
|
||||
&_cursesi_screen->savedtty) ? ERR : OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue