summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boot/ux.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/boot/ux.c b/boot/ux.c
index 46e2f130..0a34b25f 100644
--- a/boot/ux.c
+++ b/boot/ux.c
@@ -241,3 +241,31 @@ printf (const char *fmt, ...)
return 0;
}
+
+static struct sgttyb term_sgb;
+static int localbits;
+
+void
+init_termstate ()
+{
+ struct sgttyb sgb;
+ int bits;
+ ioctl (0, TIOCGETP, &term_sgb);
+ ioctl (0, TIOCLGET, &localbits);
+ /* Enter raw made. Rather than try and interpret these bits,
+ we just do what emacs does in .../emacs/src/sysdep.c for
+ an old style terminal driver. */
+ bits = localbits | LDECCTQ | LLITOUT | LPASS8 | LNOFLSH;
+ ioctl (0, TIOCLSET, &bits);
+ sgb = term_sgb;
+ sgb.sg_flags &= ~ECHO;
+ sgb.sg_flags |= RAW | ANYP;
+ ioctl (0, TIOCSETN, &sgb);
+}
+
+void
+restore_termstate ()
+{
+ ioctl (0, TIOCLSET, &localbits);
+ ioctl (0, TIOCSETN, &term_sgb);
+}