diff options
author | peter <peter@FreeBSD.org> | 1996-09-07 17:31:37 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-09-07 17:31:37 +0000 |
commit | 97c2c3819258860589699dbc09648824b6594e21 (patch) | |
tree | 2fee6cdc03991bb492d1e2698ff13b6122374589 /lib/libss | |
parent | e639a0f255b5605ba7e7a0b186fa66e70289322e (diff) | |
download | FreeBSD-src-97c2c3819258860589699dbc09648824b6594e21.zip FreeBSD-src-97c2c3819258860589699dbc09648824b6594e21.tar.gz |
use termios when POSIX is defined in the Makefile, not sgtty
Diffstat (limited to 'lib/libss')
-rw-r--r-- | lib/libss/listen.c | 18 |
1 files changed, 16 insertions, 2 deletions
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 <setjmp.h> #include <signal.h> #include <sys/param.h> -#ifdef BSD +#if defined(BSD) && !defined(POSIX) #include <sgtty.h> #endif +#ifdef POSIX +#include <termios.h> +#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); |