Always use <termios.h> interface.

This commit is contained in:
Alfred M. Szmidt
2010-10-18 18:15:04 +02:00
parent 14675d1575
commit a748d81646
9 changed files with 33 additions and 93 deletions

View File

@@ -1,3 +1,26 @@
2010-10-18 Alfred M. Szmidt <ams@gnu.org>
Always use <termios.h> interface.
* telnetd/term.c: Always use <termios.h> interface.
* telnetd/telnetd.h [!HAVE_TERMIO_H]: Don't include <termio.h>
[!HAVE_TERMIO_H && !HAVE_TERMIO_H]: Don't include <sgtty.h>.
* telnet/externs.h (USE_TERMIO): Uncondtionally define macro.
(SYSV_TERMIO) [!HAVE_TERMIOS_H && HAVE_TERMIO_H]: Undefine macro.
* talk/init_disp.c [!HAVE_TERMIOS_H]: Don't include <sys/ioctl.h>.
[!HAVE_TERMIOS_H && HAVE_SYS_IOCTL_COMPAT_H]: Don't include
<sys/ioctl_compat.h>.
* libls/ls.c: Unconditionally include <termios.h>
* src/uucpd.c: Likewise.
* configure.ac: Removed checks for termios.h and termio.h specifc
functions, variables and headers.
* bootstrap.conf (gnulib_modules): Added termios module.
2010-10-18 Mats Erik Andersson <address@hidden>
* libinetutils/tftpsubs.c (synchnet): Changed type of FROM to be

View File

@@ -69,6 +69,7 @@ strerror
strndup
strnlen
sysexits
termios
unistd-safer
unlocked-io
update-copyright

View File

@@ -466,7 +466,7 @@ AC_CHECK_HEADERS([arpa/nameser.h des.h errno.h fcntl.h features.h glob.h \
sys/sockio.h sys/sysmacros.h sys/param.h sys/file.h \
sys/proc.h sys/select.h sys/time.h sys/wait.h \
sys/resource.h \
stropts.h tcpd.h termio.h termios.h utmp.h utmpx.h unistd.h \
stropts.h tcpd.h utmp.h utmpx.h unistd.h \
vis.h], [], [], [
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_SYSTM_H
@@ -521,16 +521,6 @@ AC_CHECK_TYPE(sig_atomic_t, , AC_DEFINE([sig_atomic_t], int, [FIXME]),
[IU_FLUSHLEFT([#include <sys/types.h>
#include <signal.h> ])])
dnl Check for termio-related types and defines
AC_CHECK_TYPES(cc_t, , ,
[IU_FLUSHLEFT([#if defined(HAVE_TERMIOS_H)
# include <termios.h>
#elif defined(HAVE_TERMIO_H)
# include <termio.h>
#else
# include <sgtty.h>
#endif ])])
dnl Check for compile support for ceratin type
AC_CHECK_TYPE(long long, , AC_DEFINE([LONG_LONG], long, [Define to long if compiler does not support]))
AC_CHECK_TYPE(long double, , AC_DEFINE([LONG_DOUBLE], double, [Define to double if compiler does not support]))

View File

@@ -64,9 +64,7 @@
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#endif
#include <termios.h>
#include <intprops.h>
#include <inttostr.h>

View File

@@ -76,9 +76,7 @@
#ifdef HAVE_CRYPT_H
# include <crypt.h>
#endif
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#endif
#include <termios.h>
#ifdef HAVE_UTMP_H
# include <utmp.h>
#endif

View File

@@ -56,15 +56,7 @@
* as well as the signal handling routines.
*/
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#else
# include <sys/ioctl.h>
# ifdef HAVE_SYS_IOCTL_COMPAT_H
# include <sys/ioctl_compat.h>
# endif
#endif
#include <termios.h>
#include <unistd.h>
#include <signal.h>
#include <error.h>

View File

@@ -53,14 +53,8 @@
# define BSD 43
#endif
#ifdef HAVE_TERMIOS_H
# define USE_TERMIO
#else /* !HAVE_TERMIOS_H */
# ifdef HAVE_TERMIO_H
# define USE_TERMIO
# define SYSV_TERMIO
# endif
#endif /* HAVE_TERMIOS_H */
#define USE_TERMIO
/*
* ucb stdio.h defines BSD as something wierd

View File

@@ -51,13 +51,7 @@
#include <arpa/telnet.h>
#include <libtelnet/auth.h>
#if defined HAVE_TERMIOS_H
# include <termios.h>
#elif defined(HAVE_TERMIO_H)
# include <termio.h>
#else
# include <sgtty.h>
#endif
#include <termios.h>
#define obstack_chunk_alloc malloc
#define obstack_chunk_free free

View File

@@ -21,59 +21,9 @@
#include <telnetd.h>
#if defined HAVE_TERMIOS_H
typedef struct termios TERMDESC;
# define _term_getattr tcgetattr
# define _term_setattr(fd, tp) tcsetattr (fd, TCSANOW, tp)
#elif defined(HAVE_TERMIO_H)
typedef struct termio TERMDESC;
# define _term_getattr tcgetattr
# define _term_setattr(fd, tp) tcsetattr (fd, TCSANOW, tp)
#else
# define IOCTL_INTERFACE
typedef struct
{
struct sgttyb sg;
struct tchars tc;
struct ltchars ltc;
int state;
int lflags;
# define termdesc_eofc tc.t_eofc
# define termdesc_erase tc.sg.sg_erase
# define termdesc_kill sg.sg_kill
# define termdesc_ip tc.t_intrc
# define termdesc_abort tc.t_quitc
# define termdesc_xon tc.t_startc
# define termdesc_xoff tc.t_stopc
# define termdesc_ao ltc.t_flushc
# define termdesc_susp ltc.t_suspc
# define termdesc_ew ltc.t_werasc
# define termdesc_rp ltc.t_rprntc
# define termdesc_lnext ltc.t_lnextc
# define termdesc_forw1 tc.t_brkc
} TERMDESC;
# define cfsetospeed(tp, val) (tp)->sg.sg_ospeed = (val)
# define cfsetispeed(tp, val) (tp)->sg.sg_ispeed = (val)
# define cfgetospeed(tp) (tp)->sg.sg_ospeed
# define cfgetispeed(tp) (tp)->sg.sg_ispeed
int
_term_getattr (int fd, TERMDESC * tp)
{
ioctl (fd, TIOCGETP, (char *) &tp->sg);
ioctl (fd, TIOCGETC, (char *) &tp->tc);
ioctl (fd, TIOCGLTC, (char *) &tp->ltc);
# ifdef TIOCGSTATE
ioctl (fd, TIOCGSTATE, (char *) &tp->state);
# endif
return 0;
}
#endif
#define _term_getattr tcgetattr
#define _term_setattr(fd, tp) tcsetattr (fd, TCSANOW, tp)
TERMDESC termbuf, termbuf2;