changeset 1632:77cf72182c7f

status management
author arpi
date Wed, 22 Aug 2001 19:43:23 +0000
parents 09284c9c2b49
children 742d9e286b5d
files linux/getch2.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }