std.term [core] std.term.Mode pub struct Mode { canonical: bool, echo: bool, signals: bool, flow: bool, extended: bool, raw_cr: bool, raw_output: bool, strip8: bool, min: int, time: int, } — The terminal's mode, unpacked ([os.term.mode]). std.term.pack pub fn pack(m: Mode) -> int — The packed int the builtin reads: canonical=1, echo=2, signals=4, flow=8, extended=16, raw_cr=32, raw_output=64, strip8=128, min in bits 8..15, time in bits 16..23 ([os.term.mode]). std.term.unpack pub fn unpack(v: int) -> Mode — The Mode a packed int names. std.term.mode pub fn mode(tty: fs.File) -> Mode ! {unsupported, io} — The terminal's mode now. std.term.set_mode pub fn set_mode(tty: fs.File, m: Mode) -> () ! {unsupported, invalid, io} — Set the terminal's mode (output already written drains first; input already typed is kept). std.term.raw pub fn raw(m: Mode) -> Mode — m with input a key at a time: not canonical, no echo, no flow control and no extended input, one byte per read, no timer, so Ctrl-S, Ctrl-Q, Ctrl-V and Ctrl-O arrive as keys, as cfmakeraw(3) leaves them. std.term.raw_bytes pub fn raw_bytes(m: Mode) -> Mode — raw(m) with every byte passed through untranslated, both ways: raw_cr and raw_output on and strip8 off, so a typed Enter reads as CR (13), not LF (10, Ctrl-J's byte), a written LF reaches the terminal alone, and input keeps its eighth bit. std.term.restore_at_exit pub fn restore_at_exit(tty: fs.File, m: Mode, bytes: List[byte]) -> () ! { invalid, io, unsupported, } — s248 ([os.term.restore], ruling #93 R1 C): put the terminal back on every exit the runtime owns. Registers, for this process, a restore of tty: when the process ends — a return from main, process.exit, an error from main, a trap (after its report), the stack guard's report, process.exit_signal (before its raise), the death of the proc root — the runtime sets m exactly as set_mode sets it and then writes bytes to the terminal (an editor's alternate-screen leave and cursor show). std.term.foreground pub fn foreground(tty: fs.File) -> int ! {unsupported, io} — The terminal's foreground process group. std.term.set_foreground pub fn set_foreground(tty: fs.File, group_id: int) -> () ! {unsupported, io} — Make group_id the terminal's foreground process group. std.term.group pub fn group() -> int ! {unsupported} — This process's own process group. std.term.Size pub struct Size { rows: int, columns: int, } — The terminal's window size ([os.term.size]): rows lines of columns cells each. std.term.size pub fn size(tty: fs.File) -> Size ! {unsupported, io} — The window's size as the terminal holds it: what the emulator last told it, or what stty rows … cols … set (TIOCGWINSZ). std.term.set_size pub fn set_size(tty: fs.File, s: Size, xpixels: int, ypixels: int) -> () ! { invalid, io, unsupported, } — s292 ([os.term.size.set], sc81): set the window's size of the terminal tty names, as an emulator or stty rows … cols … does: s is the rows and the columns size reads back, on either end of a pseudo-terminal, and xpixels and ypixels the window's width and height in pixels, RFC 4254's two other fields (0 when the client does not know). std.term.Pty pub struct Pty { master: fs.File, slave: fs.File, } — A pseudo-terminal ([os.term.pty]): two std.fs files, the master, which the program that made it keeps, and a slave, the terminal another program runs on. std.term.open_pty pub fn open_pty() -> Pty ! {io, unsupported} — s292 ([os.term.pty], sc81): a new pseudo-terminal, its master and a slave, both close-on-exec; the slave granted and unlocked, and neither end this process's controlling terminal, whatever it leads. std.term.pty_name pub fn pty_name(master: fs.File) -> str ! {io, unsupported} — s292 ([os.term.pty], sc81): the slave's name for the master master names: /dev/pts/N on linux and PAX, /dev/ttysN on macOS. std.term.attr pub fn attr(tty: fs.File, op: int) -> int ! {invalid, io, unsupported} — s292 ([os.term.attr], sc81): one setting of the terminal tty names, by its RFC 4254 section 8 opcode (with RFC 8160's 42, IUTF8): a special character, 1 to 18, as its byte or -1 for disabled (as chars reads it); a flag (30 to 42 input, 50 to 62 local, 70 to 75 output, 92 and 93 control) as 0 or 1; the character size, 90 CS7 and 91 CS8, 1 for the size the terminal has; the speeds, 128 input and 129 output, in bits per second. std.term.set_attr pub fn set_attr(tty: fs.File, op: int, value: int) -> () ! {invalid, io, unsupported} — s292 ([os.term.attr], sc81): set one setting of the terminal tty names, by its RFC 4254 opcode, every other field as found (output already written drains first, as set_mode). std.term.open_controlling pub fn open_controlling(name: str) -> fs.File ! {denied, io, not_found, unsupported} — sc81: open the terminal name as THIS process's controlling terminal — the step a pty's program takes in its own session, after std.process.lead_session, so that the terminal's interrupt, quit and suspend keys, its hangup and signal.resize() reach it and /dev/tty opens ([os.term.pty], [os.term.session]). std.term.Chars pub struct Chars { erase: int, kill: int, interrupt: int, quit: int, suspend: int, end_of_file: int, word_erase: int, literal_next: int, start: int, stop: int, reprint: int, discard: int, } — The terminal's special characters ([os.term.chars]): the byte the user chose for each (stty erase ^H), or char_disabled() for one that is disabled (stty intr undef). std.term.char_disabled pub fn char_disabled() -> int — The word Chars holds for a character that is disabled: -1, the builtin's own ([os.term.chars]; the host's disabled value never reaches the program). std.term.chars_from pub fn chars_from(v: List[int]) -> Chars — The Chars a list in [os.term.chars]'s order names: erase, kill, interrupt, quit, suspend, end of file, word erase, literal next, start, stop, reprint, discard. std.term.chars pub fn chars(tty: fs.File) -> Chars ! {unsupported, io} — The terminal's special characters now.