Mercurial > mplayer.hg
comparison linux/getch2.c @ 2089:d7920c8257e2
BSD/OS support
author | arpi |
---|---|
date | Fri, 05 Oct 2001 00:39:54 +0000 |
parents | 77cf72182c7f |
children | e22bba6cb6a6 |
comparison
equal
deleted
inserted
replaced
2088:c42b1e60934a | 2089:d7920c8257e2 |
---|---|
203 | 203 |
204 void getch2_enable(){ | 204 void getch2_enable(){ |
205 struct termios tio_new; | 205 struct termios tio_new; |
206 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) | 206 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) |
207 tcgetattr(0,&tio_orig); | 207 tcgetattr(0,&tio_orig); |
208 #elif defined(__FreeBSD__) || defined(__OpenBSD__) | 208 #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) |
209 ioctl(0,TIOCGETA,&tio_orig); | 209 ioctl(0,TIOCGETA,&tio_orig); |
210 #else | 210 #else |
211 ioctl(0,TCGETS,&tio_orig); | 211 ioctl(0,TCGETS,&tio_orig); |
212 #endif | 212 #endif |
213 tio_new=tio_orig; | 213 tio_new=tio_orig; |
214 tio_new.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */ | 214 tio_new.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */ |
215 tio_new.c_cc[VMIN] = 1; | 215 tio_new.c_cc[VMIN] = 1; |
216 tio_new.c_cc[VTIME] = 0; | 216 tio_new.c_cc[VTIME] = 0; |
217 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) | 217 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) |
218 tcsetattr(0,TCSANOW,&tio_new); | 218 tcsetattr(0,TCSANOW,&tio_new); |
219 #elif defined(__FreeBSD__) || defined(__OpenBSD__) | 219 #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) |
220 ioctl(0,TIOCSETA,&tio_new); | 220 ioctl(0,TIOCSETA,&tio_new); |
221 #else | 221 #else |
222 ioctl(0,TCSETS,&tio_new); | 222 ioctl(0,TCSETS,&tio_new); |
223 #endif | 223 #endif |
224 getch2_status=1; | 224 getch2_status=1; |
226 | 226 |
227 void getch2_disable(){ | 227 void getch2_disable(){ |
228 if(!getch2_status) return; // already disabled / never enabled | 228 if(!getch2_status) return; // already disabled / never enabled |
229 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) | 229 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) |
230 tcsetattr(0,TCSANOW,&tio_orig); | 230 tcsetattr(0,TCSANOW,&tio_orig); |
231 #elif defined(__FreeBSD__) || defined(__OpenBSD__) | 231 #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) |
232 ioctl(0,TIOCSETA,&tio_orig); | 232 ioctl(0,TIOCSETA,&tio_orig); |
233 #else | 233 #else |
234 ioctl(0,TCSETS,&tio_orig); | 234 ioctl(0,TCSETS,&tio_orig); |
235 #endif | 235 #endif |
236 getch2_status=0; | 236 getch2_status=0; |