listen.c (print_prompt): Replace BSD-style ioctl with termios interface
authorTheodore Tso <tytso@mit.edu>
Wed, 27 Jan 1999 07:12:49 +0000 (07:12 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 27 Jan 1999 07:12:49 +0000 (07:12 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11133 dc483132-0cff-0310-8789-dd5450dbe970

src/util/ss/ChangeLog
src/util/ss/Makefile.in
src/util/ss/listen.c

index 5980144590bc81ad0a61555cbc9f710227024385..102ec3d319e857fdfcf7fa32e178bfdf4ce64277 100644 (file)
@@ -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
index a9c1e179496a204943897569d2d5697d7d217b20..87f7e8e5b24774bf21f836f02b7f284b24982e7c 100644 (file)
@@ -1,4 +1,6 @@
 thisconfigdir=.
+myfulldir=util/ss
+mydir=.
 BUILDTOP=$(REL)$(U)$(S)$(U)
 CFLAGS = $(CCOPTS) $(DEFS) $(LOCALINCLUDE)
 SED = sed
index c197a3f8028daa04cc7e3f45e666d63414029e94..3f819217f3496d2d3865b89ab2cdf1e48c840d20 100644 (file)
 #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);
 }