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
#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
#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;
return(0);
}
-#if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H)
-
int
term_raw(int fd, int opost, int isig)
{
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