xref: /plan9/sys/include/ape/termios.h (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1 #pragma lib "/$M/lib/ape/libap.a"
2 /* input modes */
3 #define BRKINT	0x001
4 #define ICRNL	0x002
5 #define IGNBRK	0x004
6 #define IGNCR	0x008
7 #define IGNPAR	0x010
8 #define INLCR	0x020
9 #define INPCK	0x040
10 #define ISTRIP	0x080
11 #define IXOFF	0x100
12 #define IXON	0x200
13 #define PARMRK	0x400
14 
15 /* output modes: ONLCR, TAB3 are an extension to POSIX! */
16 #define	OPOST	0000001
17 #define	OLCUC	0000002
18 #define	ONLCR	0000004
19 #define	OCRNL	0000010
20 #define	ONOCR	0000020
21 #define	ONLRET	0000040
22 #define	OFILL	0000100
23 #define	OFDEL	0000200
24 #define	NLDLY	0000400
25 #define	NL0	0
26 #define	NL1	0000400
27 #define	CRDLY	0003000
28 #define	CR0	0
29 #define	CR1	0001000
30 #define	CR2	0002000
31 #define	CR3	0003000
32 #define	TABDLY	0014000
33 #define	TAB0	0
34 #define	TAB1	0004000
35 #define	TAB2	0010000
36 #define	TAB3	0014000
37 #define	BSDLY	0020000
38 #define	BS0	0
39 #define	BS1	0020000
40 #define	VTDLY	0040000
41 #define	VT0	0
42 #define	VT1	0040000
43 #define	FFDLY	0100000
44 #define	FF0	0
45 #define	FF1	0100000
46 
47 /* control modes */
48 #define CLOCAL	0x001
49 #define CREAD	0x002
50 #define CSIZE	0x01C
51 #define CS5	0x004
52 #define CS6	0x008
53 #define CS7	0x00C
54 #define CS8	0x010
55 #define CSTOPB	0x020
56 #define HUPCL	0x040
57 #define PARENB	0x080
58 #define PARODD	0x100
59 
60 /* local modes */
61 #define ECHO	0x001
62 #define ECHOE	0x002
63 #define ECHOK	0x004
64 #define ECHONL	0x008
65 #define ICANON	0x010
66 #define IEXTEN	0x020
67 #define ISIG	0x040
68 #define NOFLSH	0x080
69 #define TOSTOP	0x100
70 
71 /* control characters */
72 #define VEOF	0
73 #define VEOL	1
74 #define VERASE	2
75 #define VINTR	3
76 #define VKILL	4
77 #define VMIN	5
78 #define VQUIT	6
79 #define VSUSP	7
80 #define VTIME	8
81 #define VSTART	9
82 #define VSTOP	10
83 #define NCCS	11
84 
85 /* baud rates */
86 #define B0	0
87 #define B50	1
88 #define B75	2
89 #define B110	3
90 #define B134	4
91 #define B150	5
92 #define B200	6
93 #define B300	7
94 #define B600	8
95 #define B1200	9
96 #define B1800	10
97 #define B2400	11
98 #define B4800	12
99 #define B9600	13
100 #define B19200	14
101 #define B38400	15
102 
103 /* optional actions for tcsetattr */
104 #define TCSANOW	  1
105 #define TCSADRAIN 2
106 #define TCSAFLUSH 3
107 
108 typedef unsigned long tcflag_t;
109 typedef unsigned long speed_t;
110 typedef unsigned char cc_t;
111 
112 struct termios {
113 	tcflag_t	c_iflag;	/* input modes */
114 	tcflag_t	c_oflag;	/* output modes */
115 	tcflag_t	c_cflag;	/* control modes */
116 	tcflag_t	c_lflag;	/* local modes */
117 	cc_t		c_cc[NCCS];	/* control characters */
118 };
119 
120 extern speed_t cfgetospeed(const struct termios *);
121 extern int cfsetospeed(struct termios *, speed_t);
122 extern speed_t cfgetispeed(const struct termios *);
123 extern int cfsetispeed(struct termios *, speed_t);
124 extern int tcgetattr(int, struct termios *);
125 extern int tcsetattr(int, int, const struct termios *);
126 #ifdef __TYPES_H
127 extern pid_t tcgetpgrp(int);
128 extern int tcsetpgrp(int, pid_t);
129 #endif
130 extern int tcdrain(int);
131 extern int tcflush(int, int);
132 extern int tcflow(int, int);
133