commit 71293168373230f176f164931d60b40dacc634dc parent a37d9484a3dc7fcd7fa6399da0930820963dd3a5 Author: Drew DeVault <sir@cmpwn.com> Date: Wed, 30 Mar 2022 12:31:30 +0200 unix::tty: add noecho Signed-off-by: Drew DeVault <sir@cmpwn.com> Diffstat:
M | unix/tty/+linux/termios.ha | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/unix/tty/+linux/termios.ha b/unix/tty/+linux/termios.ha @@ -1,6 +1,7 @@ // License: MPL-2.0 // (c) 2021 Alexey Yerin <yyp@disroot.org> // (c) 2021 Eyal Sawady <ecs@d2evs.net> +// TODO: Not in love with this interface use io; use rt; use errors; @@ -61,3 +62,10 @@ export fn makeraw(termios: *termios) (void | errors::error) = { termios_set(termios)?; }; + +// Disables "echo" on this terminal. Users should call [[termios_restore]] to +// restore settings. +export fn noecho(termios: *termios) (void | errors::error) = { + termios.current.c_lflag &= ~rt::tcflag::ECHO; + termios_set(termios)?; +};