diff options
| author | Theodore Tso <tytso@mit.edu> | 1999-01-27 07:12:49 +0000 |
|---|---|---|
| committer | Theodore Tso <tytso@mit.edu> | 1999-01-27 07:12:49 +0000 |
| commit | a65425855dbcb4369527ac0ab46d454a4cb4827d (patch) | |
| tree | 56d18a423201f9c21e5a7de643f56d9370f10cdb /src | |
| parent | 34a68f6d0a8d5545c4c20c79e351a9e8a4d0c101 (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/util/ss/ChangeLog | 5 | ||||
| -rw-r--r-- | src/util/ss/Makefile.in | 2 | ||||
| -rw-r--r-- | 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 <tytso@rsts-11.mit.edu> + + * listen.c (print_prompt): Replace BSD-style ioctl with termios + interface. + Mon Apr 6 19:45:25 1998 Tom Yu <tlyu@voltage-multiplier.mit.edu> * 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 <setjmp.h> #include <signal.h> #include <sys/param.h> -#ifdef BSD -#include <sgtty.h> -#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); } |
