From a65425855dbcb4369527ac0ab46d454a4cb4827d Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 27 Jan 1999 07:12:49 +0000 Subject: [PATCH] listen.c (print_prompt): Replace BSD-style ioctl with termios interface git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11133 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/ss/ChangeLog | 5 +++++ src/util/ss/Makefile.in | 2 ++ src/util/ss/listen.c | 17 +++++------------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/util/ss/ChangeLog b/src/util/ss/ChangeLog index 598014459..102ec3d31 100644 --- a/src/util/ss/ChangeLog +++ b/src/util/ss/ChangeLog @@ -1,3 +1,8 @@ +1999-01-20 Theodore Ts'o + + * listen.c (print_prompt): Replace BSD-style ioctl with termios + interface. + Mon Apr 6 19:45:25 1998 Tom Yu * Makefile.in (includes): Don't mkdir unless the directory doesn't diff --git a/src/util/ss/Makefile.in b/src/util/ss/Makefile.in index a9c1e1794..87f7e8e5b 100644 --- a/src/util/ss/Makefile.in +++ b/src/util/ss/Makefile.in @@ -1,4 +1,6 @@ thisconfigdir=. +myfulldir=util/ss +mydir=. BUILDTOP=$(REL)$(U)$(S)$(U) CFLAGS = $(CCOPTS) $(DEFS) $(LOCALINCLUDE) SED = sed diff --git a/src/util/ss/listen.c b/src/util/ss/listen.c index c197a3f80..3f819217f 100644 --- a/src/util/ss/listen.c +++ b/src/util/ss/listen.c @@ -14,25 +14,18 @@ #include #include #include -#ifdef BSD -#include -#endif static ss_data *current_info; static jmp_buf listen_jmpb; static RETSIGTYPE print_prompt() { -#ifdef BSD - /* put input into a reasonable mode */ - struct sgttyb ttyb; - if (ioctl(fileno(stdin), TIOCGETP, &ttyb) != -1) { - if (ttyb.sg_flags & (CBREAK|RAW)) { - ttyb.sg_flags &= ~(CBREAK|RAW); - (void) ioctl(0, TIOCSETP, &ttyb); - } + struct termios termbuf; + + if (tcgetattr(STDIN_FILENO, &termbuf) == 0) { + termbuf.c_lflag |= ICANON|ISIG|ECHO; + tcsetattr(STDIN_FILENO, TCSANOW, &termbuf); } -#endif (void) fputs(current_info->prompt, stdout); (void) fflush(stdout); } -- 2.26.2