authorgravatar for 43040593+dantecatalfamo@users.noreply.github.comDante Catalfamo <43040593+dantecatalfamo@users.noreply.github.com> 2021-11-20 04:34:53-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-11-20 01:34:53-08:00
log54bcd1cd51c6b2e146d088e943a9233e15e031ce
tree9edc18d407bbd3b4f021d567f7ec9d3e0b77d796
parenta83fb9289fe82a0e4f5c228342e79d559af69bc3
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Add OpenBSD termios constants to std.c.openbsd (#10178)


1 files changed, 127 insertions(+), 0 deletions(-)

lib/std/c/openbsd.zig+127
......@@ -703,6 +703,133 @@ pub const T = struct {
703703 pub const IOCXMTFRAME = 0x80087444;
704704};
705705
706// Term
707const V = struct {
708 pub const EOF = 0; // ICANON
709 pub const EOL = 1; // ICANON
710 pub const EOL2 = 2; // ICANON
711 pub const ERASE = 3; // ICANON
712 pub const WERASE = 4; // ICANON
713 pub const KILL = 5; // ICANON
714 pub const REPRINT = 6; // ICANON
715 // 7 spare 1
716 pub const INTR = 8; // ISIG
717 pub const QUIT = 9; // ISIG
718 pub const SUSP = 10; // ISIG
719 pub const DSUSP = 11; // ISIG
720 pub const START = 12; // IXON, IXOFF
721 pub const STOP = 13; // IXON, IXOFF
722 pub const LNEXT = 14; // IEXTEN
723 pub const DISCARD = 15; // IEXTEN
724 pub const MIN = 16; // !ICANON
725 pub const TIME = 17; // !ICANON
726 pub const STATUS = 18; // ICANON
727 // 19 spare 2
728};
729pub const NCCS = 20;
730
731// Input flags - software input processing
732pub const IGNBRK = 0x00000001; // ignore BREAK condition
733pub const BRKINT = 0x00000002; // map BREAK to SIGINT
734pub const IGNPAR = 0x00000004; // ignore (discard) parity errors
735pub const PARMRK = 0x00000008; // mark parity and framing errors
736pub const INPCK = 0x00000010; // enable checking of parity errors
737pub const ISTRIP = 0x00000020; // strip 8th bit off chars
738pub const INLCR = 0x00000040; // map NL into CR
739pub const IGNCR = 0x00000080; // ignore CR
740pub const ICRNL = 0x00000100; // map CR to NL (ala CRMOD)
741pub const IXON = 0x00000200; // enable output flow control
742pub const IXOFF = 0x00000400; // enable input flow control
743pub const IXANY = 0x00000800; // any char will restart after stop
744pub const IUCLC = 0x00001000; // translate upper to lower case
745pub const IMAXBEL = 0x00002000; // ring bell on input queue full
746
747// Output flags - software output processing
748pub const OPOST = 0x00000001; // enable following output processing
749pub const ONLCR = 0x00000002; // map NL to CR-NL (ala CRMOD)
750pub const OXTABS = 0x00000004; // expand tabs to spaces
751pub const ONOEOT = 0x00000008; // discard EOT's (^D) on output
752pub const OCRNL = 0x00000010; // map CR to NL
753pub const OLCUC = 0x00000020; // translate lower case to upper case
754pub const ONOCR = 0x00000040; // No CR output at column 0
755pub const ONLRET = 0x00000080; // NL performs the CR function
756
757// Control flags - hardware control of terminal
758pub const CIGNORE = 0x00000001; // ignore control flags
759pub const CSIZE = 0x00000300; // character size mask
760pub const CS5 = 0x00000000; // 5 bits (pseudo)
761pub const CS6 = 0x00000100; // 6 bits
762pub const CS7 = 0x00000200; // 7 bits
763pub const CS8 = 0x00000300; // 8 bits
764pub const CSTOPB = 0x00000400; // send 2 stop bits
765pub const CREAD = 0x00000800; // enable receiver
766pub const PARENB = 0x00001000; // parity enable
767pub const PARODD = 0x00002000; // odd parity, else even
768pub const HUPCL = 0x00004000; // hang up on last close
769pub const CLOCAL = 0x00008000; // ignore modem status lines
770pub const CRTSCTS = 0x00010000; // RTS/CTS full-duplex flow control
771pub const CRTS_IFLOW = CRTSCTS; // XXX compat
772pub const CCTS_OFLOW = CRTSCTS; // XXX compat
773pub const MDMBUF = 0x00100000; // DTR/DCD hardware flow control
774pub const CHWFLOW = (MDMBUF | CRTSCTS); // all types of hw flow control
775
776pub const tcflag_t = c_uint;
777pub const speed_t = c_uint;
778pub const cc_t = u8;
779
780pub const termios = extern struct {
781 iflag: tcflag_t, // input flags
782 oflag: tcflag_t, // output flags
783 cflag: tcflag_t, // control flags
784 lflag: tcflag_t, // local flags
785 cc: [NCCS]cc_t, // control chars
786 ispeed: c_int, // input speed
787 ospeed: c_int, // output speed
788};
789
790// Commands passed to tcsetattr() for setting the termios structure.
791pub const TCSA = struct {
792 pub const NOW = 0; // make change immediate
793 pub const DRAIN = 1; // drain output, then change
794 pub const FLUSH = 2; // drain output, flush input
795 pub const SOFT = 0x10; // flag - don't alter h.w. state
796};
797
798// Standard speeds
799pub const B0 = 0;
800pub const B50 = 50;
801pub const B75 = 75;
802pub const B110 = 110;
803pub const B134 = 134;
804pub const B150 = 150;
805pub const B200 = 200;
806pub const B300 = 300;
807pub const B600 = 600;
808pub const B1200 = 1200;
809pub const B1800 = 1800;
810pub const B2400 = 2400;
811pub const B4800 = 4800;
812pub const B9600 = 9600;
813pub const B19200 = 19200;
814pub const B38400 = 38400;
815pub const B7200 = 7200;
816pub const B14400 = 14400;
817pub const B28800 = 28800;
818pub const B57600 = 57600;
819pub const B76800 = 76800;
820pub const B115200 = 115200;
821pub const B230400 = 230400;
822pub const EXTA = 19200;
823pub const EXTB = 38400;
824
825pub const TCIFLUSH = 1;
826pub const TCOFLUSH = 2;
827pub const TCIOFLUSH = 3;
828pub const TCOOFF = 1;
829pub const TCOON = 2;
830pub const TCIOFF = 3;
831pub const TCION = 4;
832
706833pub const winsize = extern struct {
707834 ws_row: c_ushort,
708835 ws_col: c_ushort,