From 97c2c3819258860589699dbc09648824b6594e21 Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 7 Sep 1996 17:31:37 +0000 Subject: use termios when POSIX is defined in the Makefile, not sgtty --- lib/libss/listen.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib/libss') diff --git a/lib/libss/listen.c b/lib/libss/listen.c index 8420ad7..351129c 100644 --- a/lib/libss/listen.c +++ b/lib/libss/listen.c @@ -1,3 +1,5 @@ + + /* * Listener loop for subsystem library libss.a. * @@ -15,9 +17,12 @@ #include #include #include -#ifdef BSD +#if defined(BSD) && !defined(POSIX) #include #endif +#ifdef POSIX +#include +#endif #ifndef lint static char const rcs_id[] = @@ -37,14 +42,23 @@ static jmp_buf listen_jmpb; static sigtype print_prompt() { -#ifdef BSD /* put input into a reasonable mode */ +#if defined(BSD) && !defined(POSIX) 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); } +#endif +#ifdef POSIX + struct termios tio; + if (tcgetattr(fileno(stdin), &tio) != -1) { + tio.c_oflag |= (OPOST|ONLCR); + tio.c_iflag &= ~(IGNCR|INLCR); + tio.c_iflag |= (ICRNL); + tio.c_lflag |= (ICANON); + (void) tcsetattr(0, TCSADRAIN, &tio); } #endif (void) fputs(current_info->prompt, stdout); -- cgit v1.1