Updates the properties of the TTY.
tty_set() function is used to update the properties of the terminal (TTY). It allows modifying TTY settings such as echo, line buffering, and line feed behavior.
This function is typically used in interactive applications that need to change the behavior of the terminal, such as enabling or disabling echo, enabling or disabling line buffering, or modifying line feed behavior.
;;; Updates the properties of the the TTY (@interface func (export "tty_set") (param $state (@witx pointer $tty)) (result $error (expected (error $errno))) )
ctx: The function environment.
tty_state: A pointer to a
Ttystructure containing the new TTY state.
The function returns an
Errno value indicating the result of the operation. If the operation is successful, it returns
Errno::Success. If the TTY is not supported, it returns
tty_set()function updates the properties of the TTY.
- It checks if the TTY is available in the runtime. If it is not available, indicating that the program is not running in an interactive terminal, it returns
- If the TTY is available, it reads the
Ttystructure from the memory specified by the
- It extracts the relevant TTY properties such as
- The function then constructs a
WasiTtyStatestructure with the updated TTY properties.
- Finally, it calls the
tty_set()method on the TTY bridge with the new TTY state to update the terminal properties.
- If the operation is successful, it returns