| ... | @@ -915,6 +915,143 @@ pub const T = struct { | ... | @@ -915,6 +915,143 @@ pub const T = struct { |
| 915 | pub const IOCXMTFRAME = 0x80087444; | 915 | pub const IOCXMTFRAME = 0x80087444; |
| 916 | }; | 916 | }; |
| 917 | | 917 | |
| | 918 | // Term |
| | 919 | const V = struct { |
| | 920 | pub const EOF = 0; // ICANON |
| | 921 | pub const EOL = 1; // ICANON |
| | 922 | pub const EOL2 = 2; // ICANON |
| | 923 | pub const ERASE = 3; // ICANON |
| | 924 | pub const WERASE = 4; // ICANON |
| | 925 | pub const KILL = 5; // ICANON |
| | 926 | pub const REPRINT = 6; // ICANON |
| | 927 | // 7 spare 1 |
| | 928 | pub const INTR = 8; // ISIG |
| | 929 | pub const QUIT = 9; // ISIG |
| | 930 | pub const SUSP = 10; // ISIG |
| | 931 | pub const DSUSP = 11; // ISIG |
| | 932 | pub const START = 12; // IXON, IXOFF |
| | 933 | pub const STOP = 13; // IXON, IXOFF |
| | 934 | pub const LNEXT = 14; // IEXTEN |
| | 935 | pub const DISCARD = 15; // IEXTEN |
| | 936 | pub const MIN = 16; // !ICANON |
| | 937 | pub const TIME = 17; // !ICANON |
| | 938 | pub const STATUS = 18; // ICANON |
| | 939 | // 19 spare 2 |
| | 940 | }; |
| | 941 | |
| | 942 | // Input flags - software input processing |
| | 943 | pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition |
| | 944 | pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINT |
| | 945 | pub const IGNPAR: tcflag_t = 0x00000004; // ignore (discard) parity errors |
| | 946 | pub const PARMRK: tcflag_t = 0x00000008; // mark parity and framing errors |
| | 947 | pub const INPCK: tcflag_t = 0x00000010; // enable checking of parity errors |
| | 948 | pub const ISTRIP: tcflag_t = 0x00000020; // strip 8th bit off chars |
| | 949 | pub const INLCR: tcflag_t = 0x00000040; // map NL into CR |
| | 950 | pub const IGNCR: tcflag_t = 0x00000080; // ignore CR |
| | 951 | pub const ICRNL: tcflag_t = 0x00000100; // map CR to NL (ala CRMOD) |
| | 952 | pub const IXON: tcflag_t = 0x00000200; // enable output flow control |
| | 953 | pub const IXOFF: tcflag_t = 0x00000400; // enable input flow control |
| | 954 | pub const IXANY: tcflag_t = 0x00000800; // any char will restart after stop |
| | 955 | pub const IMAXBEL: tcflag_t = 0x00002000; // ring bell on input queue full |
| | 956 | |
| | 957 | // Output flags - software output processing |
| | 958 | pub const OPOST: tcflag_t = 0x00000001; // enable following output processing |
| | 959 | pub const ONLCR: tcflag_t = 0x00000002; // map NL to CR-NL (ala CRMOD) |
| | 960 | pub const OXTABS: tcflag_t = 0x00000004; // expand tabs to spaces |
| | 961 | pub const ONOEOT: tcflag_t = 0x00000008; // discard EOT's (^D) on output |
| | 962 | pub const OCRNL: tcflag_t = 0x00000010; // map CR to NL |
| | 963 | pub const ONOCR: tcflag_t = 0x00000040; // discard CR's when on column 0 |
| | 964 | pub const ONLRET: tcflag_t = 0x00000080; // move to column 0 on CR |
| | 965 | |
| | 966 | // Control flags - hardware control of terminal |
| | 967 | pub const CIGNORE: tcflag_t = 0x00000001; // ignore control flags |
| | 968 | pub const CSIZE: tcflag_t = 0x00000300; // character size mask |
| | 969 | pub const CS5: tcflag_t = 0x00000000; // 5 bits (pseudo) |
| | 970 | pub const CS6: tcflag_t = 0x00000100; // 6 bits |
| | 971 | pub const CS7: tcflag_t = 0x00000200; // 7 bits |
| | 972 | pub const CS8: tcflag_t = 0x00000300; // 8 bits |
| | 973 | pub const CSTOPB: tcflag_t = 0x00000400; // send 2 stop bits |
| | 974 | pub const CREAD: tcflag_t = 0x00000800; // enable receiver |
| | 975 | pub const PARENB: tcflag_t = 0x00001000; // parity enable |
| | 976 | pub const PARODD: tcflag_t = 0x00002000; // odd parity, else even |
| | 977 | pub const HUPCL: tcflag_t = 0x00004000; // hang up on last close |
| | 978 | pub const CLOCAL: tcflag_t = 0x00008000; // ignore modem status lines |
| | 979 | pub const CRTSCTS: tcflag_t = 0x00010000; // RTS/CTS full-duplex flow control |
| | 980 | pub const CRTS_IFLOW: tcflag_t = CRTSCTS; // XXX compat |
| | 981 | pub const CCTS_OFLOW: tcflag_t = CRTSCTS; // XXX compat |
| | 982 | pub const CDTRCTS: tcflag_t = 0x00020000; // DTR/CTS full-duplex flow control |
| | 983 | pub const MDMBUF: tcflag_t = 0x00100000; // DTR/DCD hardware flow control |
| | 984 | pub const CHWFLOW: tcflag_t = (MDMBUF | CRTSCTS | CDTRCTS); // all types of hw flow control |
| | 985 | |
| | 986 | pub const tcflag_t = c_uint; |
| | 987 | pub const speed_t = c_uint; |
| | 988 | pub const cc_t = u8; |
| | 989 | |
| | 990 | pub const NCCS = 20; |
| | 991 | |
| | 992 | pub const termios = extern struct { |
| | 993 | iflag: tcflag_t, // input flags |
| | 994 | oflag: tcflag_t, // output flags |
| | 995 | cflag: tcflag_t, // control flags |
| | 996 | lflag: tcflag_t, // local flags |
| | 997 | cc: [NCCS]cc_t, // control chars |
| | 998 | ispeed: c_int, // input speed |
| | 999 | ospeed: c_int, // output speed |
| | 1000 | }; |
| | 1001 | |
| | 1002 | // Commands passed to tcsetattr() for setting the termios structure. |
| | 1003 | pub const TCSA = struct { |
| | 1004 | pub const NOW = 0; // make change immediate |
| | 1005 | pub const DRAIN = 1; // drain output, then chage |
| | 1006 | pub const FLUSH = 2; // drain output, flush input |
| | 1007 | pub const SOFT = 0x10; // flag - don't alter h.w. state |
| | 1008 | }; |
| | 1009 | |
| | 1010 | // Standard speeds |
| | 1011 | pub const B0: c_uint = 0; |
| | 1012 | pub const B50: c_uint = 50; |
| | 1013 | pub const B75: c_uint = 75; |
| | 1014 | pub const B110: c_uint = 110; |
| | 1015 | pub const B134: c_uint = 134; |
| | 1016 | pub const B150: c_uint = 150; |
| | 1017 | pub const B200: c_uint = 200; |
| | 1018 | pub const B300: c_uint = 300; |
| | 1019 | pub const B600: c_uint = 600; |
| | 1020 | pub const B1200: c_uint = 1200; |
| | 1021 | pub const B1800: c_uint = 1800; |
| | 1022 | pub const B2400: c_uint = 2400; |
| | 1023 | pub const B4800: c_uint = 4800; |
| | 1024 | pub const B9600: c_uint = 9600; |
| | 1025 | pub const B19200: c_uint = 19200; |
| | 1026 | pub const B38400: c_uint = 38400; |
| | 1027 | pub const B7200: c_uint = 7200; |
| | 1028 | pub const B14400: c_uint = 14400; |
| | 1029 | pub const B28800: c_uint = 28800; |
| | 1030 | pub const B57600: c_uint = 57600; |
| | 1031 | pub const B76800: c_uint = 76800; |
| | 1032 | pub const B115200: c_uint = 115200; |
| | 1033 | pub const B230400: c_uint = 230400; |
| | 1034 | pub const B460800: c_uint = 460800; |
| | 1035 | pub const B500000: c_uint = 500000; |
| | 1036 | pub const B921600: c_uint = 921600; |
| | 1037 | pub const B1000000: c_uint = 1000000; |
| | 1038 | pub const B1500000: c_uint = 1500000; |
| | 1039 | pub const B2000000: c_uint = 2000000; |
| | 1040 | pub const B2500000: c_uint = 2500000; |
| | 1041 | pub const B3000000: c_uint = 3000000; |
| | 1042 | pub const B3500000: c_uint = 3500000; |
| | 1043 | pub const B4000000: c_uint = 4000000; |
| | 1044 | pub const EXTA: c_uint = 19200; |
| | 1045 | pub const EXTB: c_uint = 38400; |
| | 1046 | |
| | 1047 | pub const TCIFLUSH = 1; |
| | 1048 | pub const TCOFLUSH = 2; |
| | 1049 | pub const TCIOFLUSH = 3; |
| | 1050 | pub const TCOOFF = 1; |
| | 1051 | pub const TCOON = 2; |
| | 1052 | pub const TCIOFF = 3; |
| | 1053 | pub const TCION = 4; |
| | 1054 | |
| 918 | pub const winsize = extern struct { | 1055 | pub const winsize = extern struct { |
| 919 | ws_row: u16, | 1056 | ws_row: u16, |
| 920 | ws_col: u16, | 1057 | ws_col: u16, |