Skip to content

Commit

Permalink
Stop def_prog_mode() saving incorrect termio settings.
Browse files Browse the repository at this point in the history
Make set_prog_mode() set the correct settings.
I'm not certain how much restoration set_prog_mode() should do, but it
definitely doesn't want to do all of __restartwin().
Maybe __restartwin() should be calling set_prog_mode()?
  • Loading branch information
dsl authored and dsl committed Jul 10, 2003
1 parent 66173dd commit 880234a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/libcurses/tstp.c
@@ -1,4 +1,4 @@
/* $NetBSD: tstp.c,v 1.28 2003/05/28 20:19:42 dsl Exp $ */
/* $NetBSD: tstp.c,v 1.29 2003/07/10 12:50:18 dsl Exp $ */

/*
* Copyright (c) 1981, 1993, 1994
Expand Down Expand Up @@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)tstp.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: tstp.c,v 1.28 2003/05/28 20:19:42 dsl Exp $");
__RCSID("$NetBSD: tstp.c,v 1.29 2003/07/10 12:50:18 dsl Exp $");
#endif
#endif /* not lint */

Expand Down Expand Up @@ -145,8 +145,8 @@ __stopwin(void)

_cursesi_screen->endwin = 1;

return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
TCSASOFT | TCSADRAIN : TCSADRAIN,
return (tcsetattr(fileno(_cursesi_screen->infd),
__tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN,
&_cursesi_screen->orig_termios) ? ERR : OK);
}

Expand All @@ -166,8 +166,7 @@ __restartwin(void)

/* Reset the terminal state to the mode just before we stopped. */
(void) tcsetattr(fileno(_cursesi_screen->infd),
__tcaction ?
TCSASOFT | TCSADRAIN : TCSADRAIN,
__tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN,
&_cursesi_screen->save_termios);

/* Restore colours */
Expand All @@ -189,15 +188,20 @@ __restartwin(void)
int
def_prog_mode(void)
{
if (_cursesi_screen->endwin)
return ERR;

return (tcgetattr(fileno(_cursesi_screen->infd),
&_cursesi_screen->save_termios) ? ERR : OK);
}

int
reset_prog_mode(void)
{
__restartwin();
return(OK);

return tcsetattr(fileno(_cursesi_screen->infd),
__tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN,
&_cursesi_screen->save_termios) ? ERR : OK;
}

int
Expand Down

0 comments on commit 880234a

Please sign in to comment.