added HAVE_TERMIOS

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3010 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
alex 2001-11-19 17:03:38 +00:00
parent 69832c15a7
commit 601e6288fb
1 changed files with 8 additions and 0 deletions

View File

@ -16,12 +16,16 @@
#ifdef USE_IOCTL #ifdef USE_IOCTL
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#ifdef HAVE_TERMIOS
#include <sys/termios.h> #include <sys/termios.h>
#endif
#include <unistd.h> #include <unistd.h>
#include "keycodes.h" #include "keycodes.h"
#ifdef HAVE_TERMIOS
static struct termios tio_orig; static struct termios tio_orig;
#endif
static int getch2_len=0; static int getch2_len=0;
static char getch2_buf[BUF_LEN]; static char getch2_buf[BUF_LEN];
@ -202,6 +206,7 @@ found:
static int getch2_status=0; static int getch2_status=0;
void getch2_enable(){ void getch2_enable(){
#ifdef HAVE_TERMIOS
struct termios tio_new; struct termios tio_new;
#if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__)
tcgetattr(0,&tio_orig); tcgetattr(0,&tio_orig);
@ -220,18 +225,21 @@ struct termios tio_new;
ioctl(0,TIOCSETA,&tio_new); ioctl(0,TIOCSETA,&tio_new);
#else #else
ioctl(0,TCSETS,&tio_new); ioctl(0,TCSETS,&tio_new);
#endif
#endif #endif
getch2_status=1; getch2_status=1;
} }
void getch2_disable(){ void getch2_disable(){
if(!getch2_status) return; // already disabled / never enabled if(!getch2_status) return; // already disabled / never enabled
#ifdef HAVE_TERMIOS
#if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__)
tcsetattr(0,TCSANOW,&tio_orig); tcsetattr(0,TCSANOW,&tio_orig);
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
ioctl(0,TIOCSETA,&tio_orig); ioctl(0,TIOCSETA,&tio_orig);
#else #else
ioctl(0,TCSETS,&tio_orig); ioctl(0,TCSETS,&tio_orig);
#endif
#endif #endif
getch2_status=0; getch2_status=0;
} }