Subject: Missing PR's/libcurses broken
To: None <current-users@NetBSD.ORG>
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
List: current-users
Date: 11/12/1997 19:11:58
I recently (Nov 6) grabbed the -current libcurses to check if my PR (3981)
was still valid. I noticed that there was a change :
/* To allow both SIGTSTP and endwin() to come back nicely, we provide
the following routines. */
The routines are __stopwin() and __restartwin().
However, the changes aren't complete, so screw up the terminal settings of
programs returning from endwin().
I mailed an update to my PR, but I haven't seen it come past on the bugs
list (although it has made it to the database). Because I think the
-current libcurses is broken, and should be fixed for 1.3, I'm including
the relevent section of the PR here (the rest of the patches in the PR
add attribute handling to the curses library). The line numbers in this
patch might be slightly out, but it should still apply cleanly to -current
libcurses.
J
PS. Come to think of it, I don't remember seeing the original PR on the
mailing-list.
PPS. More info about the patches is in the PR update (or mail me).
--
1024/55A5BC19 0F 3F 62 56 18 10 8B 84 43 8F F4 94 93 37 76 AA
S.E.P.
---8<---------------------------- Cut here ---------------------------->8---
*** tstp.c 1997/11/08 20:58:13 1.3
--- tstp.c 1997/11/10 19:40:44 1.6
***************
*** 87,95 ****
/* restart things */
__restartwin();
- /* Repaint the screen. */
- wrefresh(curscr);
-
/* Reset the signals. */
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
}
--- 87,92 ----
***************
*** 118,130 ****
/* To allow both SIGTSTP and endwin() to come back nicely, we provide
the following routines. */
! static struct termios save;
int
__stopwin()
{
/* Get the current terminal state (which the user may have changed). */
! (void)tcgetattr(STDIN_FILENO, &save);
__restore_stophandler();
--- 115,127 ----
/* To allow both SIGTSTP and endwin() to come back nicely, we provide
the following routines. */
! static struct termios __saved_termios;
int
__stopwin()
{
/* Get the current terminal state (which the user may have changed). */
! (void)tcgetattr(STDIN_FILENO, &__saved_termios);
__restore_stophandler();
***************
*** 157,164 ****
/* Reset the terminal state to the mode just before we stopped. */
(void)tcsetattr(STDIN_FILENO, __tcaction ?
! TCSASOFT | TCSADRAIN : TCSADRAIN, &save);
/* Restart the screen. */
__startwin();
}
--- 173,183 ----
/* Reset the terminal state to the mode just before we stopped. */
(void)tcsetattr(STDIN_FILENO, __tcaction ?
! TCSASOFT | TCSADRAIN : TCSADRAIN, &__saved_termios);
/* Restart the screen. */
__startwin();
+
+ /* Repaint the screen. */
+ wrefresh(curscr);
}
*** tty.c 1997/11/08 18:30:32 1.1.1.2
--- tty.c 1997/11/10 19:44:06 1.8
***************
*** 131,136 ****
--- 131,142 ----
int
raw()
{
+ /* Check if we need to restart ... */
+ if (__endwin) {
+ __endwin = 0;
+ __restartwin();
+ }
+
useraw = __pfast = __rawmode = 1;
curt = &rawt;
return (tcsetattr(STDIN_FILENO, __tcaction ?
***************
*** 140,145 ****
--- 146,157 ----
int
noraw()
{
+ /* Check if we need to restart ... */
+ if (__endwin) {
+ __endwin = 0;
+ __restartwin();
+ }
+
useraw = __pfast = __rawmode = 0;
curt = &__baset;
return (tcsetattr(STDIN_FILENO, __tcaction ?
***************
*** 149,154 ****
--- 161,171 ----
int
cbreak()
{
+ /* Check if we need to restart ... */
+ if (__endwin) {
+ __endwin = 0;
+ __restartwin();
+ }
__rawmode = 1;
curt = useraw ? &rawt : &cbreakt;
***************
*** 159,164 ****
--- 176,186 ----
int
nocbreak()
{
+ /* Check if we need to restart ... */
+ if (__endwin) {
+ __endwin = 0;
+ __restartwin();
+ }
__rawmode = 0;
curt = useraw ? &rawt : &__baset;
***************
*** 169,174 ****
--- 191,202 ----
int
echo()
{
+ /* Check if we need to restart ... */
+ if (__endwin) {
+ __endwin = 0;
+ __restartwin();
+ }
+
rawt.c_lflag |= ECHO;
cbreakt.c_lflag |= ECHO;
__baset.c_lflag |= ECHO;
***************
*** 181,186 ****
--- 209,220 ----
int
noecho()
{
+ /* Check if we need to restart ... */
+ if (__endwin) {
+ __endwin = 0;
+ __restartwin();
+ }
+
rawt.c_lflag &= ~ECHO;
cbreakt.c_lflag &= ~ECHO;
__baset.c_lflag &= ~ECHO;
***************
*** 193,198 ****
--- 227,238 ----
int
nl()
{
+ /* Check if we need to restart ... */
+ if (__endwin) {
+ __endwin = 0;
+ __restartwin();
+ }
+
rawt.c_iflag |= ICRNL;
rawt.c_oflag |= ONLCR;
cbreakt.c_iflag |= ICRNL;
***************
*** 208,213 ****
--- 248,259 ----
int
nonl()
{
+ /* Check if we need to restart ... */
+ if (__endwin) {
+ __endwin = 0;
+ __restartwin();
+ }
+
rawt.c_iflag &= ~ICRNL;
rawt.c_oflag &= ~ONLCR;
cbreakt.c_iflag &= ~ICRNL;