diff options
Diffstat (limited to 'boot')
-rw-r--r-- | boot/ux.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -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); +} |