xref: /plan9/sys/src/ape/9src/tty.h (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1 /* input modes */
2 #define BRKINT	0x001
3 #define ICRNL	0x002
4 #define IGNBRK	0x004
5 #define IGNCR	0x008
6 #define IGNPAR	0x010
7 #define INLCR	0x020
8 #define INPCK	0x040
9 #define ISTRIP	0x080
10 #define IXOFF	0x100
11 #define IXON	0x200
12 #define PARMRK	0x400
13 
14 /* output modes */
15 #define	OPOST	0000001
16 #define	OLCUC	0000002
17 #define	ONLCR	0000004
18 #define	OCRNL	0000010
19 #define	ONOCR	0000020
20 #define	ONLRET	0000040
21 #define	OFILL	0000100
22 #define	OFDEL	0000200
23 #define	NLDLY	0000400
24 #define	NL0	0
25 #define	NL1	0000400
26 #define	CRDLY	0003000
27 #define	CR0	0
28 #define	CR1	0001000
29 #define	CR2	0002000
30 #define	CR3	0003000
31 #define	TABDLY	0014000
32 #define	TAB0	0
33 #define	TAB1	0004000
34 #define	TAB2	0010000
35 #define	TAB3	0014000
36 #define	BSDLY	0020000
37 #define	BS0	0
38 #define	BS1	0020000
39 #define	VTDLY	0040000
40 #define	VT0	0
41 #define	VT1	0040000
42 #define	FFDLY	0100000
43 #define	FF0	0
44 #define	FF1	0100000
45 
46 /* control modes */
47 #define CLOCAL	0x001
48 #define CREAD	0x002
49 #define CSIZE	0x01C
50 #define CS5	0x004
51 #define CS6	0x008
52 #define CS7	0x00C
53 #define CS8	0x010
54 #define CSTOPB	0x020
55 #define HUPCL	0x040
56 #define PARENB	0x080
57 #define PARODD	0x100
58 
59 /* local modes */
60 #define ECHO	0x001
61 #define ECHOE	0x002
62 #define ECHOK	0x004
63 #define ECHONL	0x008
64 #define ICANON	0x010
65 #define IEXTEN	0x020
66 #define ISIG	0x040
67 #define NOFLSH	0x080
68 #define TOSTOP	0x100
69 
70 /* control characters */
71 #define VEOF	0
72 #define VEOL	1
73 #define VERASE	2
74 #define VINTR	3
75 #define VKILL	4
76 #define VMIN	5
77 #define VQUIT	6
78 #define VSUSP	7
79 #define VTIME	8
80 #define VSTART	9
81 #define VSTOP	10
82 #define NCCS	11
83 
84 /* baud rates */
85 #define B0	0
86 #define B50	1
87 #define B75	2
88 #define B110	3
89 #define B134	4
90 #define B150	5
91 #define B200	6
92 #define B300	7
93 #define B600	8
94 #define B1200	9
95 #define B1800	10
96 #define B2400	11
97 #define B4800	12
98 #define B9600	13
99 #define B19200	14
100 #define B38400	15
101 
102 #define	CESC	'\\'
103 #define	CINTR	0177	/* DEL */
104 #define	CQUIT	034	/* FS, cntl | */
105 #define	CERASE	010	/* BS */
106 #define	CKILL	025	/* cntl u */
107 #define	CEOF	04	/* cntl d */
108 #define	CSTART	021	/* cntl q */
109 #define	CSTOP	023	/* cntl s */
110 #define	CSWTCH	032	/* cntl z */
111 #define CEOL	000
112 #define	CNSWTCH	0
113 
114 /* optional actions for tcsetattr */
115 #define TCSANOW	  1
116 #define TCSADRAIN 2
117 #define TCSAFLUSH 3
118 
119 typedef struct Termios Termios;
120 struct Termios
121 {
122 	int	iflag;		/* input modes */
123 	int	oflag;		/* output modes */
124 	int	cflag;		/* control modes */
125 	int	lflag;		/* local modes */
126 	uchar	cc[NCCS];	/* control characters */
127 };
128