]> granicus.if.org Git - sudo/commitdiff
Require either termios or termio, no more sgtty.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 12 Mar 2010 16:45:57 +0000 (11:45 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 12 Mar 2010 16:45:57 +0000 (11:45 -0500)
configure
configure.in
src/lbuf.c
src/script.c
src/term.c

index 82524ba66c6dd8a875f266684dc46dd8e086476e..df304bcb02d2f20f7f3e30061d995b13b0685f9b 100755 (executable)
--- a/configure
+++ b/configure
@@ -14271,8 +14271,7 @@ fi
 
 done
 
-if test "$OS" != "ultrix"; then
-    { echo "$as_me:$LINENO: checking POSIX termios" >&5
+{ echo "$as_me:$LINENO: checking POSIX termios" >&5
 echo $ECHO_N "checking POSIX termios... $ECHO_C" >&6; }
 if test "${ac_cv_sys_posix_termios+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 { echo "$as_me:$LINENO: result: $ac_cv_sys_posix_termios" >&5
 echo "${ECHO_T}$ac_cv_sys_posix_termios" >&6; }
 
-    if test "$ac_cv_sys_posix_termios" = "yes"; then
-       cat >>confdefs.h <<\_ACEOF
+if test "$ac_cv_sys_posix_termios" = "yes"; then
+    cat >>confdefs.h <<\_ACEOF
 #define HAVE_TERMIOS_H 1
 _ACEOF
 
-    else
+else
 
 for ac_header in termio.h
 do
@@ -14475,11 +14474,14 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
+else
+  { { echo "$as_me:$LINENO: error: Must have either termios.h or termio.h to build sudo" >&5
+echo "$as_me: error: Must have either termios.h or termio.h to build sudo" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 
 done
 
-    fi
 fi
 if test ${with_logincap-'no'} != "no"; then
 
index 7230243d5598445fcb6e9d2f698cc29419f0c4e1..ad504f025dea3938d4dcdf6b5ebd22a15a31ba5e 100644 (file)
@@ -1827,14 +1827,11 @@ AC_HEADER_STDC
 AC_HEADER_DIRENT
 AC_HEADER_TIME
 AC_CHECK_HEADERS(malloc.h paths.h utime.h netgroup.h sys/sockio.h sys/bsdtypes.h sys/select.h sys/stropts.h)
-dnl ultrix termio/termios are broken
-if test "$OS" != "ultrix"; then
-    AC_SYS_POSIX_TERMIOS
-    if test "$ac_cv_sys_posix_termios" = "yes"; then
-       AC_DEFINE(HAVE_TERMIOS_H)
-    else
-       AC_CHECK_HEADERS(termio.h)
-    fi
+AC_SYS_POSIX_TERMIOS
+if test "$ac_cv_sys_posix_termios" = "yes"; then
+    AC_DEFINE(HAVE_TERMIOS_H)
+else
+    AC_CHECK_HEADERS(termio.h, [], [AC_MSG_ERROR([Must have either termios.h or termio.h to build sudo])])
 fi
 if test ${with_logincap-'no'} != "no"; then
     AC_CHECK_HEADERS(login_cap.h, [LOGINCAP_USAGE='[[-c class|-]] '; LCMAN=""
index d63433230aaf7cdb2991d9aeab127724e85a8943..8f46876332112893db14d0b7f0e6e7ffd50f3c4b 100644 (file)
@@ -44,9 +44,7 @@
 #ifdef HAVE_TERMIOS_H
 # include <termios.h>
 #else
-# ifdef HAVE_TERMIO_H
-#  include <termio.h>
-# endif
+# include <termio.h>
 #endif
 
 #include "compat.h"
index 8d8858054e2fc9e14b57f1e36fa46d29dedb6769..96b319f619d3ef9b9de001e09efd644a63d54cd8 100644 (file)
 #ifdef HAVE_TERMIOS_H
 # include <termios.h>
 #else
-# ifdef HAVE_TERMIO_H
-#  include <termio.h>
-# else
-#  include <sgtty.h>
-# endif /* HAVE_TERMIO_H */
+# include <termio.h>
 #endif /* HAVE_TERMIOS_H */
 #include <sys/ioctl.h>
 #ifdef HAVE_SYS_SELECT_H
index bb5156b94dc5c47d98dba1f8d86da0b63ae56656..993f53fd9405b44aa85c9f8654bf35a17c923e21 100644 (file)
 #ifdef HAVE_TERMIOS_H
 # include <termios.h>
 #else
-# ifdef HAVE_TERMIO_H
-#  include <termio.h>
-# else
-#  include <sgtty.h>
-#  include <sys/ioctl.h>
-# endif /* HAVE_TERMIO_H */
+# include <termio.h>
 #endif /* HAVE_TERMIOS_H */
 
 #include "sudo.h"
 #endif
 
 /*
- * Compat macros for non-termios systems.
+ * Emulate POSIX termios using termio
  */
 #ifndef HAVE_TERMIOS_H
-# ifdef HAVE_TERMIO_H
-#  undef termios
-#  define termios              termio
-#  define tcgetattr(f, t)      ioctl(f, TCGETA, t)
-#  define tcsetattr(f, a, t)   ioctl(f, a, t)
-#  undef TCSAFLUSH
-#  define TCSAFLUSH            TCSETAF
-#  undef TCSADRAIN
-#  define TCSADRAIN            TCSETAW
-# else /* SGTTY */
-#  undef termios
-#  define termios              sgttyb
-#  define c_lflag              sg_flags
-#  define tcgetattr(f, t)      ioctl(f, TIOCGETP, t)
-#  define tcsetattr(f, a, t)   ioctl(f, a, t)
-#  undef TCSAFLUSH
-#  define TCSAFLUSH            TIOCSETP
-#  undef TCSADRAIN
-#  define TCSADRAIN            TIOCSETN
-# endif /* HAVE_TERMIO_H */
+# undef termios
+# define termios               termio
+# define tcgetattr(f, t)       ioctl(f, TCGETA, t)
+# define tcsetattr(f, a, t)    ioctl(f, a, t)
+# undef TCSAFLUSH
+# define TCSAFLUSH             TCSETAF
+# undef TCSADRAIN
+# define TCSADRAIN             TCSETAW
 #endif /* HAVE_TERMIOS_H */
 
 typedef struct termios sudo_term_t;
@@ -134,8 +117,6 @@ term_noecho(int fd)
     return(0);
 }
 
-#if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H)
-
 int
 term_raw(int fd, int opost, int isig)
 {
@@ -199,68 +180,3 @@ term_copy(int src, int dst, int opost)
        return(0);
     return(1);
 }
-
-#else /* SGTTY */
-
-int
-term_raw(int fd, int onlcr)
-{
-    if (!changed && ioctl(fd, TIOCGETP, &oterm) != 0)
-       return(0);
-    (void) memcpy(&term, &oterm, sizeof(term));
-    /* Set terminal to raw mode */
-    CLR(term.c_lflag, ECHO);
-    SET(term.sg_flags, RAW);
-    /* Retain NL to NLCR conversion if onlcr flag set. */
-    if (onlcr)
-       SET(term.sg_flags, CRMOD);
-    if (ioctl(fd, TIOCSETP, &term) == 0) {
-       changed = 1;
-       return(1);
-    }
-    return(0);
-}
-
-int
-term_cbreak(int fd)
-{
-    if (!changed && ioctl(fd, TIOCGETP, &oterm) != 0)
-       return(0);
-    (void) memcpy(&term, &oterm, sizeof(term));
-    /* Set terminal to half-cooked mode */
-    CLR(term.c_lflag, ECHO);
-    SET(term.sg_flags, CBREAK);
-    if (ioctl(fd, TIOCSETP, &term) == 0) {
-       term_erase = term.sg_erase;
-       term_kill = term.sg_kill;
-       changed = 1;
-       return(1);
-    }
-    return(0);
-}
-
-int
-term_copy(int src, int dst, int onlcr)
-{
-    struct sgttyb b;
-    struct tchars tc;
-    struct ltchars lc;
-    int l, lb;
-
-    if (ioctl(src, TIOCGETP, &b) != 0 || ioctl(src, TIOCGETC, &tc) != 0 ||
-       ioctl(src, TIOCGETD, &l) != 0 || ioctl(src, TIOCGLTC, &lc) != 0 ||
-       ioctl(src, TIOCLGET, &lb)) {
-       return(0);
-    }
-    /* Do not convert line endings from NL to NLCR. */
-    if (!onlcr)
-       CLR(b.sg_flags, CRMOD);
-    if (ioctl(dst, TIOCSETP, &b) != 0 || ioctl(dst, TIOCSETC, &tc) != 0 ||
-       ioctl(dst, TIOCSLTC, &lc) != 0 || ioctl(dst, TIOCLSET, &lb) != 0 ||
-       ioctl(dst, TIOCSETD, &l) != 0) {
-       return(0);
-    }
-    return(1);
-}
-
-#endif