* Fixed many tests for termio.h, termios.h, TIOCFLUSH, etc.

git-svn-id: svn://svn.zoy.org/elk/trunk@122 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-09-07 14:28:01 +00:00
parent b92e332741
commit d5784c9b41
3 changed files with 41 additions and 58 deletions

View File

@ -63,24 +63,7 @@ dnl FIXME
AC_CHECK_HEADERS(unistd.h)
# If the FIONREAD ioctl command is defined, which file must be included?
AC_MSG_CHECKING(for FIONREAD in termios.h)
AC_EGREP_HEADER(FIONREAD, termios.h, [
AC_MSG_RESULT(yes) AC_DEFINE(FIONREAD_IN_TERMIOS_H, 1, Define if <termios.h> defines FIONREAD)
],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
AC_EGREP_HEADER(FIONREAD, sys/ioctl.h, [
AC_MSG_RESULT(yes) AC_DEFINE(FIONREAD_IN_SYS_IOCTL_H, 1, Define if <sys/ioctl.h> defines FIONREAD)
],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for FIONREAD in sys/filio.h)
AC_EGREP_HEADER(FIONREAD, sys/filio.h, [
AC_MSG_RESULT(yes) AC_DEFINE(FIONREAD_IN_SYS_FILIO_H, 1, Define if <sys/filio.h> defines FIONREAD)
],[
AC_MSG_RESULT(no)
])
])
])
AC_CHECK_HEADERS(termios.h sys/ioctl.h sys/filio.h)
# If getdtablesize() is available to determine the maximum number of open
# files per process, set getdtablesize=yes.
@ -249,16 +232,22 @@ AC_DEFINE(TERMIO, 1, [FIXME HARD])
# tiocflush use TIOCFLUSH ioctl from <sys/ioctl.h>
# tcflsh use TCFLSH ioctl from <termio.h>
# Leave the variable(s) empty if flushing is not supported.
if false; then
AC_DEFINE(FLUSH_BSD, 1, [FIXME HARD])
AC_CHECK_FUNCS(fpurge)
AC_CACHE_CHECK([for BSD-style flushing],
[ac_cv_have_bsd_flush],
[AC_TRY_COMPILE(
[#include <stdio.h>],
[FILE *f;
f->_cnt = 0;
f->_ptr = f->_base;],
ac_cv_have_bsd_flush=yes,
ac_cv_have_bsd_flush=no)])
if test "${ac_cv_have_bsd_flush}" = "yes"; then
AC_DEFINE(HAVE_BSD_FLUSH, 1, [Define if you have BSD-style flushing])
fi
if false; then
AC_DEFINE(FLUSH_FPURGE, 1, [FIXME HARD])
fi
if false; then
AC_DEFINE(FLUSH_TIOCFLUSH, 1, [FIXME HARD])
fi
AC_DEFINE(FLUSH_TCFLSH, 1, [FIXME HARD])
AC_CHECK_HEADERS(termio.h termios.h)
# The interpreter uses the getrlimit function to determine the maximum
# stack size of the running program. If this function is not supported,

View File

@ -35,12 +35,14 @@
#include <ctype.h>
#include <stdarg.h>
#ifdef FLUSH_TIOCFLUSH
# include <sys/ioctl.h>
#else
#ifdef FLUSH_TCFLSH
# include <termio.h>
#if defined(HAVE_TERMIO_H)
# include <termio.h>
#elif defined(HAVE_TERMIOS_H)
# include <termios.h>
#endif
#if defined(HAVE_SYS_IOCTL_H)
# include <sys/ioctl.h>
#endif
#include "kernel.h"
@ -203,21 +205,18 @@ void Discard_Output (Object port) {
if (PORT(port)->flags & P_STRING)
return;
f = PORT(port)->file;
#ifdef FLUSH_FPURGE
#if defined(HAVE_FPURGE)
(void)fpurge (f);
#else
#ifdef FLUSH_BSD
#elif defined(HAVE_BSD_FLUSH)
f->_cnt = 0;
f->_ptr = f->_base;
#endif
#endif
#ifdef FLUSH_TIOCFLUSH
#if defined(TIOCFLUSH)
(void)ioctl (fileno (f), TIOCFLUSH, (char *)0);
#else
#ifdef FLUSH_TCFLSH
#elif defined(TCFLSH)
(void)ioctl (fileno (f), TCFLSH, (char *)1);
#endif
#endif
}
Object P_Flush_Output_Port (int argc, Object *argv) {

View File

@ -34,19 +34,17 @@
#include <limits.h>
#include <string.h>
#ifdef FLUSH_TIOCFLUSH
# include <sys/ioctl.h>
#else
#ifdef FLUSH_TCFLSH
# include <termio.h>
#endif
#if defined(HAVE_TERMIO_H)
# include <termio.h>
#elif defined(HAVE_TERMIOS_H)
# include <termios.h>
#endif
#if defined(FIONREAD_IN_TERMIOS_H)
# include <termios.h>
#elif defined(FIONREAD_IN_SYS_IOCTL_H)
#if defined(HAVE_SYS_IOCTL_H)
# include <sys/ioctl.h>
#elif defined(FIONREAD_IN_SYS_FILIO_H)
#endif
#if defined(HAVE_SYS_FILIO_H)
# include <sys/filio.h>
#endif
@ -146,21 +144,18 @@ void Discard_Input (Object port) {
if (PORT(port)->flags & P_STRING)
return;
f = PORT(port)->file;
#ifdef FLUSH_FPURGE
#if defined(HAVE_FPURGE)
(void)fpurge (f);
#else
#ifdef FLUSH_BSD
#elif defined(HAVE_BSD_FLUSH)
f->_cnt = 0;
f->_ptr = f->_base;
#endif
#endif
#ifdef FLUSH_TIOCFLUSH
#if defined(TIOCFLUSH)
(void)ioctl (fileno (f), TIOCFLUSH, (char *)0);
#else
#ifdef FLUSH_TCFLSH
#elif defined(TCFLSH)
(void)ioctl (fileno (f), TCFLSH, (char *)0);
#endif
#endif
}
Object P_Unread_Char (int argc, Object *argv) {