# HG changeset patch # User arpi # Date 998509403 0 # Node ID 77cf72182c7fad864c73096152b5bac698fc456e # Parent 09284c9c2b4909a451cbe32683a9c7e0fcc9e585 status management diff -r 09284c9c2b49 -r 77cf72182c7f linux/getch2.c --- a/linux/getch2.c Wed Aug 22 19:40:46 2001 +0000 +++ b/linux/getch2.c Wed Aug 22 19:43:23 2001 +0000 @@ -199,6 +199,8 @@ return code; } +static int getch2_status=0; + void getch2_enable(){ struct termios tio_new; #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) @@ -219,9 +221,11 @@ #else ioctl(0,TCSETS,&tio_new); #endif + getch2_status=1; } void getch2_disable(){ + if(!getch2_status) return; // already disabled / never enabled #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) tcsetattr(0,TCSANOW,&tio_orig); #elif defined(__FreeBSD__) || defined(__OpenBSD__) @@ -229,5 +233,6 @@ #else ioctl(0,TCSETS,&tio_orig); #endif + getch2_status=0; }