Changed terminal io defines

This commit is contained in:
Michiel Broek 2004-11-30 19:33:53 +00:00
parent 5b2f97b243
commit b04eb35add
5 changed files with 259 additions and 13 deletions

View File

@ -166,6 +166,15 @@
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H #undef HAVE_SYS_WAIT_H
/* Define if you have the <sys/termio.h> header file. */
#undef HAVE_SYS_TERMIO_H
/* Define if you have the <sys/termios.h> header file. */
#undef HAVE_SYS_TERMIOS_H
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIO_H
/* Define if you have the <termios.h> header file. */ /* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H #undef HAVE_TERMIOS_H
@ -175,6 +184,9 @@
/* Define if you have the <usersec.h> header file. */ /* Define if you have the <usersec.h> header file. */
#undef HAVE_USERSEC_H #undef HAVE_USERSEC_H
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define if you have the <utmp.h> header file. */ /* Define if you have the <utmp.h> header file. */
#undef HAVE_UTMP_H #undef HAVE_UTMP_H

155
configure vendored
View File

@ -5621,8 +5621,161 @@ fi
for ac_header in termios.h sys/termios.h termio.h sys/termio.h sgtty.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
for ac_header in sys/time.h termios.h sys/vfs.h unistd.h netinet/in.h regex.h ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ------------------------------------------ ##
## Report this to the AC_PACKAGE_NAME lists. ##
## ------------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_header in sys/time.h sys/vfs.h unistd.h netinet/in.h regex.h
do do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then if eval "test \"\${$as_ac_Header+set}\" = set"; then

View File

@ -223,7 +223,8 @@ AC_HEADER_STDC
AC_HEADER_DIRENT AC_HEADER_DIRENT
AC_HEADER_TIME AC_HEADER_TIME
AC_HEADER_SYS_WAIT AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(sys/time.h termios.h sys/vfs.h unistd.h netinet/in.h regex.h) AC_CHECK_HEADERS(termios.h sys/termios.h termio.h sys/termio.h sgtty.h)
AC_CHECK_HEADERS(sys/time.h sys/vfs.h unistd.h netinet/in.h regex.h)
AC_CHECK_HEADERS(sys/resource.h usersec.h gshadow.h shadow.h) AC_CHECK_HEADERS(sys/resource.h usersec.h gshadow.h shadow.h)
AC_CHECK_HEADERS(limits.h utmp.h utmpx.h lastlog.h rpc/key_prot.h) AC_CHECK_HEADERS(limits.h utmp.h utmpx.h lastlog.h rpc/key_prot.h)
AC_STRUCT_TIMEZONE AC_STRUCT_TIMEZONE

View File

@ -57,7 +57,6 @@
#include <errno.h> #include <errno.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <termios.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <dirent.h> #include <dirent.h>
@ -93,6 +92,50 @@
#include <pthread.h> #include <pthread.h>
#include <sys/poll.h> #include <sys/poll.h>
/* used to use #elif, but native braindead hpux 9.00 c compiler didn't
* * understand it */
#ifdef HAVE_TERMIOS_H
/* get rid of warnings on SCO ODT 3.2 */
struct termios;
# include <termios.h>
# define USE_TERMIOS
#else
# if defined(HAVE_SYS_TERMIOS_H)
# include <sys/termios.h>
# define USE_TERMIOS
# else
# if defined(HAVE_TERMIO_H)
# include <termio.h>
# define USE_TERMIO
# else
# if defined(HAVE_SYS_TERMIO_H)
# include <sys/termio.h>
# define USE_TERMIO
# else
# if defined(HAVE_SGTTY_H)
# include <sgtty.h>
# define USE_SGTTY
# ifdef LLITOUT
extern long Locmode; /* Saved "local mode" for 4.x BSD "new driver" */
extern long Locbit; /* Bit SUPPOSED to disable output translations */
# endif
# else
# error neither termio.h nor sgtty.h found. Cannot continue.
# endif
# endif
# endif
# endif
#endif
#ifdef USE_SGTTY
# ifdef TIOCSBRK
# define CANBREAK
# endif
#endif
#ifdef USE_TERMIO
# define CANBREAK
#endif
#include <stddef.h> #include <stddef.h>
#include <fcntl.h> #include <fcntl.h>
#if defined(__FreeBSD__) || defined(__NetBSD__) #if defined(__FreeBSD__) || defined(__NetBSD__)

View File

@ -33,16 +33,37 @@
#include "openport.h" #include "openport.h"
#include "zmmisc.h" #include "zmmisc.h"
#ifdef USE_SGTTY
# ifdef LLITOUT
long Locmode; /* Saved "local mode" for 4.x BSD "new driver" */
long Locbit = LLITOUT; /* Bit SUPPOSED to disable output translations */
# endif
#endif
#ifdef USE_TERMIOS
struct termios oldtty, tty;
#else
# if defined(USE_TERMIO)
struct termio oldtty, tty;
# else
struct sgttyb oldtty, tty;
struct tchars oldtch, tch;
# endif
#endif
int hanged_up = 0; int hanged_up = 0;
static struct termios oldtty; /* Saved termios */
static struct termios tty;
unsigned Baudrate = 2400; unsigned Baudrate = 2400;
/* Next is on compile commandline in lrzsz */ /* Next is on compile commandline in lrzsz */
#define NFGVMIN 1 #define NFGVMIN 1
#define HOWMANY 255 #define HOWMANY 255
#if defined(HOWMANY) && HOWMANY > 255
#ifndef NFGVMIN
Howmany must be 255 or less
#endif
#endif
static struct { static struct {
unsigned baudr; unsigned baudr;
@ -164,6 +185,8 @@ int io_mode(int fd, int n)
Syslog('t', "io_mode(%d, %d)", fd, n); Syslog('t', "io_mode(%d, %d)", fd, n);
switch(n) { switch(n) {
#ifdef USE_TERMIOS
case 2: case 2:
if (!did0) { if (!did0) {
did0 = TRUE; did0 = TRUE;
@ -246,6 +269,15 @@ int io_mode(int fd, int n)
tcflow (fd,TCOON); /* restart output */ tcflow (fd,TCOON); /* restart output */
return 0; return 0;
#endif
#ifdef USE_TERMIO
#error USE_TERMIO driver not coded
#endif
#ifdef USE_SGTTY
#error USE_SGTTY driver not coded
#endif
} }
return -1; return -1;
} }
@ -273,14 +305,19 @@ void sendbrk(void)
Syslog('t', "Send break"); Syslog('t', "Send break");
if (isatty(0)) { if (isatty(0)) {
#if (defined(TIOCSBRK)) #ifdef USE_TERMIOS
Syslog('t', "TIOCSBRK"); tcsendbreak(fd,0);
ioctl(0, TIOCSBRK, 0L); #endif
#elif (defined(TCSBRK)) #ifdef USE_TERMIO
Syslog('t', "TCSBRK"); ioctl(fd, TCSBRK, 0);
ioctl(0, TCSBRK, 0L); #endif
#else /* any ideas about BSD? */ #ifdef USE_SGTTY
; #ifdef TIOCSBRK
sleep(1);
ioctl(fd, TIOCSBRK, 0);
sleep(1);
ioctl(fd, TIOCCBRK, 0);
#endif
#endif #endif
} }
} }