summaryrefslogtreecommitdiff
path: root/libc/termios/termios.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/termios/termios.c')
-rw-r--r--libc/termios/termios.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/libc/termios/termios.c b/libc/termios/termios.c
index 3789c38..a617e86 100644
--- a/libc/termios/termios.c
+++ b/libc/termios/termios.c
@@ -140,7 +140,7 @@ int fd;
#endif
#ifdef L_cfgetospeed
-int cfgetospeed(tp)
+speed_t cfgetospeed(tp)
struct termios *tp;
{
return (tp->c_cflag & CBAUD);
@@ -148,7 +148,7 @@ struct termios *tp;
#endif
#ifdef L_cfgetispeed
-int cfgetispeed(tp)
+speed_t cfgetispeed(tp)
struct termios *tp;
{
return (tp->c_cflag & CBAUD);
@@ -181,5 +181,40 @@ struct termios *tp; speed_t speed;
return cfsetospeed(tp, speed);
}
#endif
+
+/* From linux libc-4.6.27 again */
+#ifdef L_cfmakeraw
+/* Copyright (C) 1992 Free Software Foundation, Inc.
+This file is part of the GNU C Library.*/
+
+void
+cfmakeraw(t)
+struct termios *t;
+{
+/* I changed it to the current form according to the suggestions
+ * from Bruce Evans. Thanks Bruce. Please report the problems to
+ * H.J. Lu (hlu@eecs.wsu.edu).
+ */
+
+/*
+ * I took out the bits commented out by #if 1...#else - RHP
+ */
+
+ /* VMIN = 0 means non-blocking for Linux */
+ t->c_cc[VMIN] = 1; t->c_cc[VTIME] = 1;
+ /* clear some bits with &= ~(bits), set others with |= */
+ t->c_cflag &= ~(CSIZE|PARENB|CSTOPB);
+ t->c_cflag |= (CS8|HUPCL|CREAD);
+ t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|INPCK|ISTRIP);
+ t->c_iflag &= ~(INLCR|IGNCR|ICRNL|IXON|IXOFF);
+ t->c_iflag |= (BRKINT|IGNPAR);
+ t->c_oflag &= ~(OPOST|OLCUC|OCRNL|ONOCR|ONLRET|OFILL|OFDEL);
+ t->c_oflag &= ~(NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
+ t->c_oflag |= (ONLCR|NL0|CR0|TAB3|BS0|VT0|FF0);
+ t->c_lflag &= ~(ISIG|ICANON|IEXTEN|ECHO|ECHOE|ECHOK|ECHONL);
+ t->c_lflag &= ~(NOFLSH|XCASE);
+ t->c_lflag &= ~(ECHOPRT|ECHOCTL|ECHOKE);
+}
+#endif
#endif