summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/termios.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/gen/termios.c')
-rw-r--r--lib/libc/gen/termios.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/libc/gen/termios.c b/lib/libc/gen/termios.c
index fc21757..7e9f169 100644
--- a/lib/libc/gen/termios.c
+++ b/lib/libc/gen/termios.c
@@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
#include <errno.h>
+#include <string.h>
+#define TTYDEFCHARS
#include <termios.h>
#include <unistd.h>
#include "un-namespace.h"
@@ -173,6 +175,23 @@ cfmakeraw(struct termios *t)
t->c_cc[VTIME] = 0;
}
+/*
+ * Obtain a termios structure which is similar to the one provided by
+ * the kernel.
+ */
+void
+cfmakesane(struct termios *t)
+{
+
+ t->c_cflag = TTYDEF_CFLAG;
+ t->c_iflag = TTYDEF_IFLAG;
+ t->c_lflag = TTYDEF_LFLAG;
+ t->c_oflag = TTYDEF_OFLAG;
+ t->c_ispeed = TTYDEF_SPEED;
+ t->c_ospeed = TTYDEF_SPEED;
+ memcpy(&t->c_cc, ttydefchars, sizeof ttydefchars);
+}
+
int
tcsendbreak(int fd, int len __unused)
{
OpenPOWER on IntegriCloud