Module sys/tty
sys/tty
TTY operations.
Types
WinSize
struct
WinSize
Terminal window size.
Fields
| Name | Type | Description |
|---|---|---|
width | i32 | Width in columns. |
height | i32 | Height in rows. |
Functions
tty_init
function
fn(fd : i32) -> i32
Initialize TTY for a fd. Returns 0 on success, -errno on failure.
Parameters
| Name | Type | Notes |
|---|---|---|
fd | i32 |
Returns: i32
tty_set_mode
function
fn(fd : i32, mode : i32) -> i32
Set TTY mode (normal, raw, IO). Returns 0 on success, -errno on failure.
Parameters
| Name | Type | Notes |
|---|---|---|
fd | i32 | |
mode | i32 |
Returns: i32
tty_reset
function
fn() -> i32
Reset TTY to original mode. Returns 0 on success, -errno on failure.
Returns: i32
tty_winsize
function
fn(fd : i32) -> WinSize
Get terminal window size. Returns width and height (0,0 on error).
Parameters
| Name | Type | Notes |
|---|---|---|
fd | i32 |
Returns: WinSize
isatty
function
fn(fd : i32) -> bool
Check if fd is a TTY.
Parameters
| Name | Type | Notes |
|---|---|---|
fd | i32 |
Returns: bool
Constants
Value: 0
Value: 1
Value: 2