Mercurial > mplayer.hg
comparison linux/getch2.c @ 1632:77cf72182c7f
status management
author | arpi |
---|---|
date | Wed, 22 Aug 2001 19:43:23 +0000 |
parents | 267264560623 |
children | d7920c8257e2 |
comparison
equal
deleted
inserted
replaced
1631:09284c9c2b49 | 1632:77cf72182c7f |
---|---|
197 for(i=0;i<getch2_len;i++) getch2_buf[i]=getch2_buf[len+i]; | 197 for(i=0;i<getch2_len;i++) getch2_buf[i]=getch2_buf[len+i]; |
198 } | 198 } |
199 return code; | 199 return code; |
200 } | 200 } |
201 | 201 |
202 static int getch2_status=0; | |
203 | |
202 void getch2_enable(){ | 204 void getch2_enable(){ |
203 struct termios tio_new; | 205 struct termios tio_new; |
204 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) | 206 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) |
205 tcgetattr(0,&tio_orig); | 207 tcgetattr(0,&tio_orig); |
206 #elif defined(__FreeBSD__) || defined(__OpenBSD__) | 208 #elif defined(__FreeBSD__) || defined(__OpenBSD__) |
217 #elif defined(__FreeBSD__) || defined(__OpenBSD__) | 219 #elif defined(__FreeBSD__) || defined(__OpenBSD__) |
218 ioctl(0,TIOCSETA,&tio_new); | 220 ioctl(0,TIOCSETA,&tio_new); |
219 #else | 221 #else |
220 ioctl(0,TCSETS,&tio_new); | 222 ioctl(0,TCSETS,&tio_new); |
221 #endif | 223 #endif |
224 getch2_status=1; | |
222 } | 225 } |
223 | 226 |
224 void getch2_disable(){ | 227 void getch2_disable(){ |
228 if(!getch2_status) return; // already disabled / never enabled | |
225 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) | 229 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) |
226 tcsetattr(0,TCSANOW,&tio_orig); | 230 tcsetattr(0,TCSANOW,&tio_orig); |
227 #elif defined(__FreeBSD__) || defined(__OpenBSD__) | 231 #elif defined(__FreeBSD__) || defined(__OpenBSD__) |
228 ioctl(0,TIOCSETA,&tio_orig); | 232 ioctl(0,TIOCSETA,&tio_orig); |
229 #else | 233 #else |
230 ioctl(0,TCSETS,&tio_orig); | 234 ioctl(0,TCSETS,&tio_orig); |
231 #endif | 235 #endif |
232 } | 236 getch2_status=0; |
233 | 237 } |
238 |