comparison linux/getch2.c @ 1433:d2c90f272101

Win32 portability.
author atmos4
date Thu, 02 Aug 2001 07:09:41 +0000
parents b36fb1ae4b53
children 267264560623
comparison
equal deleted inserted replaced
1432:62b9f4b52b4f 1433:d2c90f272101
199 return code; 199 return code;
200 } 200 }
201 201
202 void getch2_enable(){ 202 void getch2_enable(){
203 struct termios tio_new; 203 struct termios tio_new;
204 #if defined(__NetBSD__) || defined(__svr4__) 204 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__)
205 tcgetattr(0,&tio_orig); 205 tcgetattr(0,&tio_orig);
206 #elif defined(__FreeBSD__) 206 #elif defined(__FreeBSD__)
207 ioctl(0,TIOCGETA,&tio_orig); 207 ioctl(0,TIOCGETA,&tio_orig);
208 #else 208 #else
209 ioctl(0,TCGETS,&tio_orig); 209 ioctl(0,TCGETS,&tio_orig);
210 #endif 210 #endif
211 tio_new=tio_orig; 211 tio_new=tio_orig;
212 tio_new.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */ 212 tio_new.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */
213 tio_new.c_cc[VMIN] = 1; 213 tio_new.c_cc[VMIN] = 1;
214 tio_new.c_cc[VTIME] = 0; 214 tio_new.c_cc[VTIME] = 0;
215 #if defined(__NetBSD__) || defined(__svr4__) 215 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__)
216 tcsetattr(0,TCSANOW,&tio_new); 216 tcsetattr(0,TCSANOW,&tio_new);
217 #elif defined(__FreeBSD__) 217 #elif defined(__FreeBSD__)
218 ioctl(0,TIOCSETA,&tio_new); 218 ioctl(0,TIOCSETA,&tio_new);
219 #else 219 #else
220 ioctl(0,TCSETS,&tio_new); 220 ioctl(0,TCSETS,&tio_new);
221 #endif 221 #endif
222 } 222 }
223 223
224 void getch2_disable(){ 224 void getch2_disable(){
225 #if defined(__NetBSD__) || defined(__svr4__) 225 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__)
226 tcsetattr(0,TCSANOW,&tio_orig); 226 tcsetattr(0,TCSANOW,&tio_orig);
227 #elif defined(__FreeBSD__) 227 #elif defined(__FreeBSD__)
228 ioctl(0,TIOCSETA,&tio_orig); 228 ioctl(0,TIOCSETA,&tio_orig);
229 #else 229 #else
230 ioctl(0,TCSETS,&tio_orig); 230 ioctl(0,TCSETS,&tio_orig);