diff --git a/lib/std/c/openbsd.zig b/lib/std/c/openbsd.zig index 39425b5e0e..6ca0135843 100644 --- a/lib/std/c/openbsd.zig +++ b/lib/std/c/openbsd.zig @@ -703,6 +703,133 @@ pub const T = struct { pub const IOCXMTFRAME = 0x80087444; }; +// Term +const V = struct { + pub const EOF = 0; // ICANON + pub const EOL = 1; // ICANON + pub const EOL2 = 2; // ICANON + pub const ERASE = 3; // ICANON + pub const WERASE = 4; // ICANON + pub const KILL = 5; // ICANON + pub const REPRINT = 6; // ICANON + // 7 spare 1 + pub const INTR = 8; // ISIG + pub const QUIT = 9; // ISIG + pub const SUSP = 10; // ISIG + pub const DSUSP = 11; // ISIG + pub const START = 12; // IXON, IXOFF + pub const STOP = 13; // IXON, IXOFF + pub const LNEXT = 14; // IEXTEN + pub const DISCARD = 15; // IEXTEN + pub const MIN = 16; // !ICANON + pub const TIME = 17; // !ICANON + pub const STATUS = 18; // ICANON + // 19 spare 2 +}; +pub const NCCS = 20; + +// Input flags - software input processing +pub const IGNBRK = 0x00000001; // ignore BREAK condition +pub const BRKINT = 0x00000002; // map BREAK to SIGINT +pub const IGNPAR = 0x00000004; // ignore (discard) parity errors +pub const PARMRK = 0x00000008; // mark parity and framing errors +pub const INPCK = 0x00000010; // enable checking of parity errors +pub const ISTRIP = 0x00000020; // strip 8th bit off chars +pub const INLCR = 0x00000040; // map NL into CR +pub const IGNCR = 0x00000080; // ignore CR +pub const ICRNL = 0x00000100; // map CR to NL (ala CRMOD) +pub const IXON = 0x00000200; // enable output flow control +pub const IXOFF = 0x00000400; // enable input flow control +pub const IXANY = 0x00000800; // any char will restart after stop +pub const IUCLC = 0x00001000; // translate upper to lower case +pub const IMAXBEL = 0x00002000; // ring bell on input queue full + +// Output flags - software output processing +pub const OPOST = 0x00000001; // enable following output processing +pub const ONLCR = 0x00000002; // map NL to CR-NL (ala CRMOD) +pub const OXTABS = 0x00000004; // expand tabs to spaces +pub const ONOEOT = 0x00000008; // discard EOT's (^D) on output +pub const OCRNL = 0x00000010; // map CR to NL +pub const OLCUC = 0x00000020; // translate lower case to upper case +pub const ONOCR = 0x00000040; // No CR output at column 0 +pub const ONLRET = 0x00000080; // NL performs the CR function + +// Control flags - hardware control of terminal +pub const CIGNORE = 0x00000001; // ignore control flags +pub const CSIZE = 0x00000300; // character size mask +pub const CS5 = 0x00000000; // 5 bits (pseudo) +pub const CS6 = 0x00000100; // 6 bits +pub const CS7 = 0x00000200; // 7 bits +pub const CS8 = 0x00000300; // 8 bits +pub const CSTOPB = 0x00000400; // send 2 stop bits +pub const CREAD = 0x00000800; // enable receiver +pub const PARENB = 0x00001000; // parity enable +pub const PARODD = 0x00002000; // odd parity, else even +pub const HUPCL = 0x00004000; // hang up on last close +pub const CLOCAL = 0x00008000; // ignore modem status lines +pub const CRTSCTS = 0x00010000; // RTS/CTS full-duplex flow control +pub const CRTS_IFLOW = CRTSCTS; // XXX compat +pub const CCTS_OFLOW = CRTSCTS; // XXX compat +pub const MDMBUF = 0x00100000; // DTR/DCD hardware flow control +pub const CHWFLOW = (MDMBUF | CRTSCTS); // all types of hw flow control + +pub const tcflag_t = c_uint; +pub const speed_t = c_uint; +pub const cc_t = u8; + +pub const termios = extern struct { + iflag: tcflag_t, // input flags + oflag: tcflag_t, // output flags + cflag: tcflag_t, // control flags + lflag: tcflag_t, // local flags + cc: [NCCS]cc_t, // control chars + ispeed: c_int, // input speed + ospeed: c_int, // output speed +}; + +// Commands passed to tcsetattr() for setting the termios structure. +pub const TCSA = struct { + pub const NOW = 0; // make change immediate + pub const DRAIN = 1; // drain output, then change + pub const FLUSH = 2; // drain output, flush input + pub const SOFT = 0x10; // flag - don't alter h.w. state +}; + +// Standard speeds +pub const B0 = 0; +pub const B50 = 50; +pub const B75 = 75; +pub const B110 = 110; +pub const B134 = 134; +pub const B150 = 150; +pub const B200 = 200; +pub const B300 = 300; +pub const B600 = 600; +pub const B1200 = 1200; +pub const B1800 = 1800; +pub const B2400 = 2400; +pub const B4800 = 4800; +pub const B9600 = 9600; +pub const B19200 = 19200; +pub const B38400 = 38400; +pub const B7200 = 7200; +pub const B14400 = 14400; +pub const B28800 = 28800; +pub const B57600 = 57600; +pub const B76800 = 76800; +pub const B115200 = 115200; +pub const B230400 = 230400; +pub const EXTA = 19200; +pub const EXTB = 38400; + +pub const TCIFLUSH = 1; +pub const TCOFLUSH = 2; +pub const TCIOFLUSH = 3; +pub const TCOOFF = 1; +pub const TCOON = 2; +pub const TCIOFF = 3; +pub const TCION = 4; + pub const winsize = extern struct { ws_row: c_ushort, ws_col: c_ushort,