| ... | @@ -1576,37 +1576,37 @@ pub const VTIME = 17; | ... | @@ -1576,37 +1576,37 @@ pub const VTIME = 17; |
| 1576 | pub const VSTATUS = 18; | 1576 | pub const VSTATUS = 18; |
| 1577 | pub const NCCS = 20; // 2 spares (7, 19) | 1577 | pub const NCCS = 20; // 2 spares (7, 19) |
| 1578 | | 1578 | |
| 1579 | pub const IGNBRK = 0x00000001; | 1579 | pub const IGNBRK = 0x00000001; // ignore BREAK condition |
| 1580 | pub const BRKINT = 0x00000002; | 1580 | pub const BRKINT = 0x00000002; // map BREAK to SIGINTR |
| 1581 | pub const IGNPAR = 0x00000004; | 1581 | pub const IGNPAR = 0x00000004; // ignore (discard) parity errors |
| 1582 | pub const PARMRK = 0x00000008; | 1582 | pub const PARMRK = 0x00000008; // mark parity and framing errors |
| 1583 | pub const INPCK = 0x00000010; | 1583 | pub const INPCK = 0x00000010; // enable checking of parity errors |
| 1584 | pub const ISTRIP = 0x00000020; | 1584 | pub const ISTRIP = 0x00000020; // strip 8th bit off chars |
| 1585 | pub const INLCR = 0x00000040; | 1585 | pub const INLCR = 0x00000040; // map NL into CR |
| 1586 | pub const IGNCR = 0x00000080; | 1586 | pub const IGNCR = 0x00000080; // ignore CR |
| 1587 | pub const ICRNL = 0x00000100; | 1587 | pub const ICRNL = 0x00000100; // map CR to NL (ala CRMOD) |
| 1588 | pub const IXON = 0x00000200; | 1588 | pub const IXON = 0x00000200; // enable output flow control |
| 1589 | pub const IXOFF = 0x00000400; | 1589 | pub const IXOFF = 0x00000400; // enable input flow control |
| 1590 | pub const IXANY = 0x00000800; | 1590 | pub const IXANY = 0x00000800; // any char will restart after stop |
| 1591 | pub const IMAXBEL = 0x00002000; | 1591 | pub const IMAXBEL = 0x00002000; // ring bell on input queue full |
| 1592 | pub const IUTF8 = 0x00004000; | 1592 | pub const IUTF8 = 0x00004000; // maintain state for UTF-8 VERASE |
| 1593 | | 1593 | |
| 1594 | pub const OPOST = 0x00000001; | 1594 | pub const OPOST = 0x00000001; //enable following output processing |
| 1595 | pub const ONLCR = 0x00000002; | 1595 | pub const ONLCR = 0x00000002; // map NL to CR-NL (ala CRMOD) |
| 1596 | pub const OXTABS = 0x00000004; | 1596 | pub const OXTABS = 0x00000004; // expand tabs to spaces |
| 1597 | pub const ONOEOT = 0x00000008; | 1597 | pub const ONOEOT = 0x00000008; // discard EOT's (^D) on output) |
| 1598 | | 1598 | |
| 1599 | pub const OCRNL = 0x00000010; | 1599 | pub const OCRNL = 0x00000010; // map CR to NL on output |
| 1600 | pub const ONOCR = 0x00000020; | 1600 | pub const ONOCR = 0x00000020; // no CR output at column 0 |
| 1601 | pub const ONLRET = 0x00000040; | 1601 | pub const ONLRET = 0x00000040; // NL performs CR function |
| 1602 | pub const OFILL = 0x00000080; | 1602 | pub const OFILL = 0x00000080; // use fill characters for delay |
| 1603 | pub const NLDLY = 0x00000300; | 1603 | pub const NLDLY = 0x00000300; // \n delay |
| 1604 | pub const TABDLY = 0x00000c04; | 1604 | pub const TABDLY = 0x00000c04; // horizontal tab delay |
| 1605 | pub const CRDLY = 0x00003000; | 1605 | pub const CRDLY = 0x00003000; // \r delay |
| 1606 | pub const FFDLY = 0x00004000; | 1606 | pub const FFDLY = 0x00004000; // form feed delay |
| 1607 | pub const BSDLY = 0x00008000; | 1607 | pub const BSDLY = 0x00008000; // \b delay |
| 1608 | pub const VTDLY = 0x00010000; | 1608 | pub const VTDLY = 0x00010000; // vertical tab delay |
| 1609 | pub const OFDEL = 0x00020000; | 1609 | pub const OFDEL = 0x00020000; // fill is DEL, else NUL |
| 1610 | | 1610 | |
| 1611 | pub const NL0 = 0x00000000; | 1611 | pub const NL0 = 0x00000000; |
| 1612 | pub const NL1 = 0x00000100; | 1612 | pub const NL1 = 0x00000100; |
| ... | @@ -1627,48 +1627,48 @@ pub const BS1 = 0x00008000; | ... | @@ -1627,48 +1627,48 @@ pub const BS1 = 0x00008000; |
| 1627 | pub const VT0 = 0x00000000; | 1627 | pub const VT0 = 0x00000000; |
| 1628 | pub const VT1 = 0x00010000; | 1628 | pub const VT1 = 0x00010000; |
| 1629 | | 1629 | |
| 1630 | pub const CIGNORE = 0x00000001; | 1630 | pub const CIGNORE = 0x00000001; // ignore control flags |
| 1631 | pub const CSIZE = 0x00000300; | 1631 | pub const CSIZE = 0x00000300; // character size mask |
| 1632 | pub const CS5 = 0x00000000; | 1632 | pub const CS5 = 0x00000000; // 5 bits (pseudo) |
| 1633 | pub const CS6 = 0x00000100; | 1633 | pub const CS6 = 0x00000100; // 6 bits |
| 1634 | pub const CS7 = 0x00000200; | 1634 | pub const CS7 = 0x00000200; // 7 bits |
| 1635 | pub const CS8 = 0x00000300; | 1635 | pub const CS8 = 0x00000300; // 8 bits |
| 1636 | pub const CSTOPB = 0x00000400; | 1636 | pub const CSTOPB = 0x0000040; // send 2 stop bits |
| 1637 | pub const CREAD = 0x00000800; | 1637 | pub const CREAD = 0x00000800; // enable receiver |
| 1638 | pub const PARENB = 0x00001000; | 1638 | pub const PARENB = 0x00001000; // parity enable |
| 1639 | pub const PARODD = 0x00002000; | 1639 | pub const PARODD = 0x00002000; // odd parity, else even |
| 1640 | pub const HUPCL = 0x00004000; | 1640 | pub const HUPCL = 0x00004000; // hang up on last close |
| 1641 | pub const CLOCAL = 0x00008000; | 1641 | pub const CLOCAL = 0x00008000; // ignore modem status lines |
| 1642 | pub const CCTS_OFLOW = 0x00010000; | 1642 | pub const CCTS_OFLOW = 0x00010000; // CTS flow control of output |
| 1643 | pub const CRTSCTS = (CCTS_OFLOW | CRTS_IFLOW); | 1643 | pub const CRTSCTS = (CCTS_OFLOW | CRTS_IFLOW); |
| 1644 | pub const CRTS_IFLOW = 0x00020000; | 1644 | pub const CRTS_IFLOW = 0x00020000; // RTS flow control of input |
| 1645 | pub const CDTR_IFLOW = 0x00040000; | 1645 | pub const CDTR_IFLOW = 0x00040000; // DTR flow control of input |
| 1646 | pub const CDSR_OFLOW = 0x00080000; | 1646 | pub const CDSR_OFLOW = 0x00080000; // DSR flow control of output |
| 1647 | pub const CCAR_OFLOW = 0x00100000; | 1647 | pub const CCAR_OFLOW = 0x00100000; // DCD flow control of output |
| 1648 | pub const MDMBUF = 0x00100000; | 1648 | pub const MDMBUF = 0x00100000; // old name for CCAR_OFLOW |
| 1649 | | 1649 | |
| 1650 | pub const ECHOKE = 0x00000001; | 1650 | pub const ECHOKE = 0x00000001; // visual erase for line kill |
| 1651 | pub const ECHOE = 0x00000002; | 1651 | pub const ECHOE = 0x00000002; // visually erase chars |
| 1652 | pub const ECHOK = 0x00000004; | 1652 | pub const ECHOK = 0x00000004; // echo NL after line kill |
| 1653 | pub const ECHO = 0x00000008; | 1653 | pub const ECHO = 0x00000008; // enable echoing |
| 1654 | pub const ECHONL = 0x00000010; | 1654 | pub const ECHONL = 0x00000010; // echo NL even if ECHO is off |
| 1655 | pub const ECHOPRT = 0x00000020; | 1655 | pub const ECHOPRT = 0x00000020; // visual erase mode for hardcopy |
| 1656 | pub const ECHOCTL = 0x00000040; | 1656 | pub const ECHOCTL = 0x00000040; // echo control chars as ^(Char) |
| 1657 | pub const ISIG = 0x00000080; | 1657 | pub const ISIG = 0x00000080; // enable signals INTR, QUIT, [D]SUSP |
| 1658 | pub const ICANON = 0x00000100; | 1658 | pub const ICANON = 0x00000100; // canonicalize input lines |
| 1659 | pub const ALTWERASE = 0x00000200; | 1659 | pub const ALTWERASE = 0x00000200; // use alternate WERASE algorithm |
| 1660 | pub const IEXTEN = 0x00000400; | 1660 | pub const IEXTEN = 0x00000400; // enable DISCARD and LNEXT |
| 1661 | pub const EXTPROC = 0x00000800; | 1661 | pub const EXTPROC = 0x00000800; // external processing |
| 1662 | pub const TOSTOP = 0x00400000; | 1662 | pub const TOSTOP = 0x00400000; // stop background jobs from output |
| 1663 | pub const FLUSHO = 0x00800000; | 1663 | pub const FLUSHO = 0x00800000; // output being flushed (state) |
| 1664 | pub const NOKERNINFO = 0x02000000; | 1664 | pub const NOKERNINFO = 0x02000000; // no kernel output from VSTATUS |
| 1665 | pub const PENDIN = 0x20000000; | 1665 | pub const PENDIN = 0x20000000; // XXX retype pending input (state) |
| 1666 | pub const NOFLSH = 0x80000000; | 1666 | pub const NOFLSH = 0x80000000; // don't flush after interrupt |
| 1667 | | 1667 | |
| 1668 | pub const TCSANOW = 0; | 1668 | pub const TCSANOW = 0; // make change immediate |
| 1669 | pub const TCSADRAIN = 1; | 1669 | pub const TCSADRAIN = 1; // drain output, then change |
| 1670 | pub const TCSAFLUSH = 2; | 1670 | pub const TCSAFLUSH = 2; // drain output, flush input |
| 1671 | pub const TCSASOFT = 0x10; | 1671 | pub const TCSASOFT = 0x10; // flag - don't alter h.w. state |
| 1672 | pub const TCSA = extern enum(c_uint) { | 1672 | pub const TCSA = extern enum(c_uint) { |
| 1673 | NOW, | 1673 | NOW, |
| 1674 | DRAIN, | 1674 | DRAIN, |
| ... | @@ -1715,13 +1715,13 @@ pub const speed_t = u64; | ... | @@ -1715,13 +1715,13 @@ pub const speed_t = u64; |
| 1715 | pub const tcflag_t = u64; | 1715 | pub const tcflag_t = u64; |
| 1716 | | 1716 | |
| 1717 | pub const termios = extern struct { | 1717 | pub const termios = extern struct { |
| 1718 | iflag: tcflag_t, | 1718 | iflag: tcflag_t, // input flags |
| 1719 | oflag: tcflag_t, | 1719 | oflag: tcflag_t, // output flags |
| 1720 | cflag: tcflag_t, | 1720 | cflag: tcflag_t, // control flags |
| 1721 | lflag: tcflag_t, | 1721 | lflag: tcflag_t, // local flags |
| 1722 | cc: [NCCS]cc_t, | 1722 | cc: [NCCS]cc_t, // control chars |
| 1723 | ispeed: speed_t align(8), | 1723 | ispeed: speed_t align(8), // input speed |
| 1724 | ospeed: speed_t, | 1724 | ospeed: speed_t, // output speed |
| 1725 | }; | 1725 | }; |
| 1726 | | 1726 | |
| 1727 | pub const winsize = extern struct { | 1727 | pub const winsize = extern struct { |
| ... | @@ -1731,9 +1731,9 @@ pub const winsize = extern struct { | ... | @@ -1731,9 +1731,9 @@ pub const winsize = extern struct { |
| 1731 | ws_ypixel: u16, | 1731 | ws_ypixel: u16, |
| 1732 | }; | 1732 | }; |
| 1733 | | 1733 | |
| 1734 | pub const TIOCGWINSZ = comptime ior(0x40000000, 't', 104, @sizeOf(winsize)); | 1734 | pub const TIOCGWINSZ = ior(0x40000000, 't', 104, @sizeOf(winsize)); |
| 1735 | pub const IOCPARM_MASK = 0x1fff; | 1735 | pub const IOCPARM_MASK = 0x1fff; |
| 1736 | | 1736 | |
| 1737 | fn ior(comptime inout: u32, comptime group: usize, comptime num: usize, comptime len: usize) usize { | 1737 | fn ior(inout: u32, group: usize, num: usize, len: usize) usize { |
| 1738 | return (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)); | 1738 | return (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)); |
| 1739 | } | 1739 | } |