This patch is for machines which don't have the old BSD tty API, but do support the POSIX style termios terminal control. nothing is changed unless you define USE_POSIX_TERMIOS in the makefile *** read_pwd.c.orig Fri Oct 15 10:45:46 1993 --- read_pwd.c Tue Nov 16 10:17:55 1993 *************** *** 6,11 **** --- 6,12 ---- #include #include + #ifndef USE_POSIX_TERMIOS #ifndef VMS #ifndef MSDOS #ifndef _IRIX *************** *** 43,48 **** --- 44,52 ---- long iosb$l_info; }; #endif + #else + #include + #endif static void read_till_nl(); static int read_pw(); *************** *** 119,124 **** --- 123,129 ---- char *prompt; int verify; { + #ifndef USE_POSIX_TERMIOS #ifndef VMS #ifndef MSDOS struct sgttyb tty_orig,tty_new; *************** *** 130,135 **** --- 135,144 ---- long status; unsigned short channel = 0; #endif + #else + /* USE_POSIX_TERMIOS */ + struct termios tty_orig,tty_new; + #endif int ok=0; char *p; int ps=0; *************** *** 142,147 **** --- 151,157 ---- if ((tty=fopen("con","r")) == NULL) tty=stdin; #endif /* MSDOS */ + #ifndef USE_POSIX_TERMIOS #ifndef VMS #ifdef TIOCGETP if (ioctl(fileno(tty),TIOCGETP,(char *)&tty_orig) == -1) *************** *** 156,161 **** --- 166,177 ---- if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL)) return(-1); #endif + #else + /* USE_POSIX_TERMIOS */ + if (tcgetattr(fileno(tty),&tty_orig) != 0) + return (-1);; + bcopy(&(tty_orig),&(tty_new),sizeof(tty_orig)); + #endif if (setjmp(save)) { *************** *** 164,169 **** --- 180,186 ---- } pushsig(); ps=1; + #ifndef USE_POSIX_TERMIOS #ifndef VMS #ifndef MSDOS tty_new.sg_flags &= ~ECHO; *************** *** 180,185 **** --- 197,209 ---- if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL)) return(-1); #endif /* VMS */ + #else + /* USE_POSIX_TERMIOS */ + tty_new.c_lflag &= ~ECHO; + tcdrain(fileno(tty)); + if (tcsetattr(fileno(tty),TCSAFLUSH, &tty_new) != 0) + return (-1); + #endif ps=2; while (!ok) *************** *** 217,222 **** --- 241,247 ---- error: fprintf(stderr,"\n"); /* What can we do if there is an error? */ + #ifndef USE_POSIX_TERMIOS #ifndef VMS #ifdef TIOCSETP if (ps >= 2) ioctl(fileno(tty),TIOCSETP,(char *)&tty_orig); *************** *** 226,231 **** --- 251,263 ---- status = SYS$QIOW(0,channel,IO$_SETMODE,&iosb,0,0 ,tty_orig,12,0,0,0,0); #endif /* VMS */ + #else + /* USE_POSIX_TERMIOS */ + if (ps >= 2) { + tcdrain(fileno(tty)); + tcsetattr(fileno(tty),TCSAFLUSH,&tty_orig); + } + #endif if (ps >= 1) popsig(); if (stdin != tty) fclose(tty);