[MPlayer-dev-eng] [RFC] purpose on ioctls in osdep/getch2?

Rich Felker dalias at aerifal.cx
Sat Dec 9 18:51:40 CET 2006


On Sat, Dec 09, 2006 at 01:46:30PM +0100, Reimar Döffinger wrote:
> Hello,
> does anyone know why we use all this ifdef crap? The whole code is only
> used when termios.h is available, and in addition tcgetattr/tcsetattr is
> in POSIX, and I personally tested that it definitely is also available
> on at least Apple and FreeBSD.
> So why do we try to use ioctls?
> Here part of the code:
> #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__) || defined(_AIX)
>     tcgetattr(0,&tio_orig);
> #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
>     ioctl(0,TIOCGETA,&tio_orig);
> #else
>     ioctl(0,TCGETS,&tio_orig);
> #endif
> 
> Do you know of anything speaking against just replacing it by
> tcgetattr(0,&tio_orig);

The above code is wrong and should be fixed like you say. At the
_very_ least, the default case must be posix, not some broken legacy crap.

Rich




More information about the MPlayer-dev-eng mailing list