* 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:
parent
b92e332741
commit
d5784c9b41
43
configure.ac
43
configure.ac
|
@ -63,24 +63,7 @@ dnl FIXME
|
||||||
AC_CHECK_HEADERS(unistd.h)
|
AC_CHECK_HEADERS(unistd.h)
|
||||||
|
|
||||||
# If the FIONREAD ioctl command is defined, which file must be included?
|
# If the FIONREAD ioctl command is defined, which file must be included?
|
||||||
AC_MSG_CHECKING(for FIONREAD in termios.h)
|
AC_CHECK_HEADERS(termios.h sys/ioctl.h sys/filio.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)
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
# If getdtablesize() is available to determine the maximum number of open
|
# If getdtablesize() is available to determine the maximum number of open
|
||||||
# files per process, set getdtablesize=yes.
|
# files per process, set getdtablesize=yes.
|
||||||
|
@ -249,16 +232,22 @@ AC_DEFINE(TERMIO, 1, [FIXME HARD])
|
||||||
# tiocflush use TIOCFLUSH ioctl from <sys/ioctl.h>
|
# tiocflush use TIOCFLUSH ioctl from <sys/ioctl.h>
|
||||||
# tcflsh use TCFLSH ioctl from <termio.h>
|
# tcflsh use TCFLSH ioctl from <termio.h>
|
||||||
# Leave the variable(s) empty if flushing is not supported.
|
# Leave the variable(s) empty if flushing is not supported.
|
||||||
if false; then
|
AC_CHECK_FUNCS(fpurge)
|
||||||
AC_DEFINE(FLUSH_BSD, 1, [FIXME HARD])
|
|
||||||
|
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
|
fi
|
||||||
if false; then
|
|
||||||
AC_DEFINE(FLUSH_FPURGE, 1, [FIXME HARD])
|
AC_CHECK_HEADERS(termio.h termios.h)
|
||||||
fi
|
|
||||||
if false; then
|
|
||||||
AC_DEFINE(FLUSH_TIOCFLUSH, 1, [FIXME HARD])
|
|
||||||
fi
|
|
||||||
AC_DEFINE(FLUSH_TCFLSH, 1, [FIXME HARD])
|
|
||||||
|
|
||||||
# The interpreter uses the getrlimit function to determine the maximum
|
# The interpreter uses the getrlimit function to determine the maximum
|
||||||
# stack size of the running program. If this function is not supported,
|
# stack size of the running program. If this function is not supported,
|
||||||
|
|
25
src/print.c
25
src/print.c
|
@ -35,12 +35,14 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef FLUSH_TIOCFLUSH
|
#if defined(HAVE_TERMIO_H)
|
||||||
# include <sys/ioctl.h>
|
# include <termio.h>
|
||||||
#else
|
#elif defined(HAVE_TERMIOS_H)
|
||||||
#ifdef FLUSH_TCFLSH
|
# include <termios.h>
|
||||||
# include <termio.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_SYS_IOCTL_H)
|
||||||
|
# include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
@ -203,21 +205,18 @@ void Discard_Output (Object port) {
|
||||||
if (PORT(port)->flags & P_STRING)
|
if (PORT(port)->flags & P_STRING)
|
||||||
return;
|
return;
|
||||||
f = PORT(port)->file;
|
f = PORT(port)->file;
|
||||||
#ifdef FLUSH_FPURGE
|
#if defined(HAVE_FPURGE)
|
||||||
(void)fpurge (f);
|
(void)fpurge (f);
|
||||||
#else
|
#elif defined(HAVE_BSD_FLUSH)
|
||||||
#ifdef FLUSH_BSD
|
|
||||||
f->_cnt = 0;
|
f->_cnt = 0;
|
||||||
f->_ptr = f->_base;
|
f->_ptr = f->_base;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#ifdef FLUSH_TIOCFLUSH
|
#if defined(TIOCFLUSH)
|
||||||
(void)ioctl (fileno (f), TIOCFLUSH, (char *)0);
|
(void)ioctl (fileno (f), TIOCFLUSH, (char *)0);
|
||||||
#else
|
#elif defined(TCFLSH)
|
||||||
#ifdef FLUSH_TCFLSH
|
|
||||||
(void)ioctl (fileno (f), TCFLSH, (char *)1);
|
(void)ioctl (fileno (f), TCFLSH, (char *)1);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object P_Flush_Output_Port (int argc, Object *argv) {
|
Object P_Flush_Output_Port (int argc, Object *argv) {
|
||||||
|
|
31
src/read.c
31
src/read.c
|
@ -34,19 +34,17 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef FLUSH_TIOCFLUSH
|
#if defined(HAVE_TERMIO_H)
|
||||||
# include <sys/ioctl.h>
|
# include <termio.h>
|
||||||
#else
|
#elif defined(HAVE_TERMIOS_H)
|
||||||
#ifdef FLUSH_TCFLSH
|
# include <termios.h>
|
||||||
# include <termio.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FIONREAD_IN_TERMIOS_H)
|
#if defined(HAVE_SYS_IOCTL_H)
|
||||||
# include <termios.h>
|
|
||||||
#elif defined(FIONREAD_IN_SYS_IOCTL_H)
|
|
||||||
# include <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>
|
# include <sys/filio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -146,21 +144,18 @@ void Discard_Input (Object port) {
|
||||||
if (PORT(port)->flags & P_STRING)
|
if (PORT(port)->flags & P_STRING)
|
||||||
return;
|
return;
|
||||||
f = PORT(port)->file;
|
f = PORT(port)->file;
|
||||||
#ifdef FLUSH_FPURGE
|
#if defined(HAVE_FPURGE)
|
||||||
(void)fpurge (f);
|
(void)fpurge (f);
|
||||||
#else
|
#elif defined(HAVE_BSD_FLUSH)
|
||||||
#ifdef FLUSH_BSD
|
|
||||||
f->_cnt = 0;
|
f->_cnt = 0;
|
||||||
f->_ptr = f->_base;
|
f->_ptr = f->_base;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#ifdef FLUSH_TIOCFLUSH
|
#if defined(TIOCFLUSH)
|
||||||
(void)ioctl (fileno (f), TIOCFLUSH, (char *)0);
|
(void)ioctl (fileno (f), TIOCFLUSH, (char *)0);
|
||||||
#else
|
#elif defined(TCFLSH)
|
||||||
#ifdef FLUSH_TCFLSH
|
|
||||||
(void)ioctl (fileno (f), TCFLSH, (char *)0);
|
(void)ioctl (fileno (f), TCFLSH, (char *)0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object P_Unread_Char (int argc, Object *argv) {
|
Object P_Unread_Char (int argc, Object *argv) {
|
||||||
|
|
Loading…
Reference in New Issue