hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit c7760b1fa39f2a031958d246c4200812bb5c015a
parent 4e9163356102730d375f0f31b50d8e91b597fc98
Author: Sebastian LaVine <mail@smlavine.com>
Date:   Thu, 19 Oct 2023 21:44:27 -0400

unix::tty: add noncanonical

Signed-off-by: Sebastian LaVine <mail@smlavine.com>

Diffstat:
Munix/tty/+freebsd/termios.ha | 7+++++++
Munix/tty/+linux/termios.ha | 7+++++++
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/unix/tty/+freebsd/termios.ha b/unix/tty/+freebsd/termios.ha @@ -68,3 +68,10 @@ export fn noecho(termios: *termios) (void | errors::error) = { termios.current.c_lflag &= ~rt::tcflag::ECHO; termios_set(termios)?; }; + +// Enables "noncanonical" mode for this terminal, disabling line buffering and +// line editing. Users should call [[termios_restore]] to restore settings. +export fn noncanonical(termios: *termios) (void | errors::error) = { + termios.current.c_lflag &= ~rt::tcflag::ICANON; + termios_set(termios)?; +}; diff --git a/unix/tty/+linux/termios.ha b/unix/tty/+linux/termios.ha @@ -69,3 +69,10 @@ export fn noecho(termios: *termios) (void | errors::error) = { termios.current.c_lflag &= ~rt::tcflag::ECHO; termios_set(termios)?; }; + +// Enables "noncanonical" mode for this terminal, disabling line buffering and +// line editing. Users should call [[termios_restore]] to restore settings. +export fn noncanonical(termios: *termios) (void | errors::error) = { + termios.current.c_lflag &= ~rt::tcflag::ICANON; + termios_set(termios)?; +};