summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-09-07 17:31:37 +0000
committerpeter <peter@FreeBSD.org>1996-09-07 17:31:37 +0000
commit97c2c3819258860589699dbc09648824b6594e21 (patch)
tree2fee6cdc03991bb492d1e2698ff13b6122374589
parente639a0f255b5605ba7e7a0b186fa66e70289322e (diff)
downloadFreeBSD-src-97c2c3819258860589699dbc09648824b6594e21.zip
FreeBSD-src-97c2c3819258860589699dbc09648824b6594e21.tar.gz
use termios when POSIX is defined in the Makefile, not sgtty
-rw-r--r--lib/libss/listen.c18
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);
OpenPOWER on IntegriCloud