Commit | Line | Data |
---|---|---|
47628c26 | 1 | /* |
f8d4a907 | 2 | * Copyright (c) 1988, 1989 The Regents of the University of California. |
5fc41d78 | 3 | * All rights reserved. |
47628c26 | 4 | * |
1c15e888 C |
5 | * Redistribution is only permitted until one year after the first shipment |
6 | * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and | |
7 | * binary forms are permitted provided that: (1) source distributions retain | |
8 | * this entire copyright notice and comment, and (2) distributions including | |
9 | * binaries display the following acknowledgement: This product includes | |
10 | * software developed by the University of California, Berkeley and its | |
11 | * contributors'' in the documentation or other materials provided with the | |
12 | * distribution and in all advertising materials mentioning features or use | |
13 | * of this software. Neither the name of the University nor the names of | |
14 | * its contributors may be used to endorse or promote products derived from | |
15 | * this software without specific prior written permission. | |
16 | * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | |
17 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | |
18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
5fc41d78 | 19 | * |
1c15e888 | 20 | * @(#)termios.h 7.18 (Berkeley) 6/28/90 |
47628c26 MT |
21 | */ |
22 | ||
23 | /* | |
e84b8d0c | 24 | * termios structure |
47628c26 MT |
25 | */ |
26 | #ifndef _TERMIOS_ | |
27 | #define _TERMIOS_ | |
28 | ||
47628c26 MT |
29 | /* |
30 | * Special Control Characters | |
31 | * | |
32 | * Index into c_cc[] character array. | |
33 | * | |
34 | * Name Subscript Enabled by | |
35 | */ | |
36 | #define VEOF 0 /* ICANON */ | |
37 | #define VEOL 1 /* ICANON */ | |
f8d4a907 | 38 | #ifndef _POSIX_SOURCE |
47628c26 | 39 | #define VEOL2 2 /* ICANON */ |
75183d37 | 40 | #endif |
47628c26 | 41 | #define VERASE 3 /* ICANON */ |
f8d4a907 | 42 | #ifndef _POSIX_SOURCE |
47628c26 | 43 | #define VWERASE 4 /* ICANON */ |
75183d37 | 44 | #endif |
47628c26 | 45 | #define VKILL 5 /* ICANON */ |
f8d4a907 | 46 | #ifndef _POSIX_SOURCE |
47628c26 | 47 | #define VREPRINT 6 /* ICANON */ |
75183d37 | 48 | #endif |
31925d8c | 49 | /* 7 spare 1 */ |
47628c26 MT |
50 | #define VINTR 8 /* ISIG */ |
51 | #define VQUIT 9 /* ISIG */ | |
52 | #define VSUSP 10 /* ISIG */ | |
f8d4a907 | 53 | #ifndef _POSIX_SOURCE |
47628c26 | 54 | #define VDSUSP 11 /* ISIG */ |
75183d37 | 55 | #endif |
47628c26 MT |
56 | #define VSTART 12 /* IXON, IXOFF */ |
57 | #define VSTOP 13 /* IXON, IXOFF */ | |
f8d4a907 | 58 | #ifndef _POSIX_SOURCE |
47628c26 | 59 | #define VLNEXT 14 /* IEXTEN */ |
325c8cd3 | 60 | #define VDISCARD 15 /* IEXTEN */ |
75183d37 | 61 | #endif |
47628c26 MT |
62 | #define VMIN 16 /* !ICANON */ |
63 | #define VTIME 17 /* !ICANON */ | |
f8d4a907 | 64 | #ifndef _POSIX_SOURCE |
40f88ff5 | 65 | #define VSTATUS 18 /* ICANON */ |
3531cdfa | 66 | /* 19 spare 2 */ |
37aee2ee | 67 | #define NCCS 20 |
75183d37 | 68 | #endif |
47628c26 | 69 | |
e84b8d0c | 70 | #define _POSIX_VDISABLE ((unsigned char)'\377') |
47628c26 | 71 | |
31925d8c MT |
72 | #ifndef _POSIX_SOURCE |
73 | #define CCEQ(val, c) (c == val ? val != _POSIX_VDISABLE : 0) | |
74 | #endif | |
75 | ||
47628c26 MT |
76 | /* |
77 | * Input flags - software input processing | |
78 | */ | |
79 | #define IGNBRK 0x00000001 /* ignore BREAK condition */ | |
80 | #define BRKINT 0x00000002 /* map BREAK to SIGINTR */ | |
e84b8d0c | 81 | #define IGNPAR 0x00000004 /* ignore (discard) parity errors */ |
47628c26 | 82 | #define PARMRK 0x00000008 /* mark parity and framing errors */ |
f8d4a907 | 83 | #define INPCK 0x00000010 /* enable checking of parity errors */ |
47628c26 MT |
84 | #define ISTRIP 0x00000020 /* strip 8th bit off chars */ |
85 | #define INLCR 0x00000040 /* map NL into CR */ | |
86 | #define IGNCR 0x00000080 /* ignore CR */ | |
87 | #define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */ | |
88 | #define IXON 0x00000200 /* enable output flow control */ | |
47628c26 | 89 | #define IXOFF 0x00000400 /* enable input flow control */ |
f8d4a907 | 90 | #ifndef _POSIX_SOURCE |
47628c26 | 91 | #define IXANY 0x00000800 /* any char will restart after stop */ |
47628c26 | 92 | #define IMAXBEL 0x00002000 /* ring bell on input queue full */ |
f8d4a907 | 93 | #endif /*_POSIX_SOURCE */ |
47628c26 MT |
94 | |
95 | /* | |
96 | * Output flags - software output processing | |
97 | */ | |
e84b8d0c | 98 | #define OPOST 0x00000001 /* enable following output processing */ |
f8d4a907 | 99 | #ifndef _POSIX_SOURCE |
47628c26 MT |
100 | #define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */ |
101 | #define OXTABS 0x00000004 /* expand tabs to spaces */ | |
e84b8d0c | 102 | #define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */ |
f8d4a907 | 103 | #endif /*_POSIX_SOURCE */ |
47628c26 MT |
104 | |
105 | /* | |
106 | * Control flags - hardware control of terminal | |
107 | */ | |
f8d4a907 | 108 | #ifndef _POSIX_SOURCE |
31925d8c | 109 | #define CIGNORE 0x00000001 /* ignore control flags */ |
75183d37 | 110 | #endif |
47628c26 | 111 | #define CSIZE 0x00000300 /* character size mask */ |
5c41479c | 112 | #define CS5 0x00000000 /* 5 bits (pseudo) */ |
47628c26 MT |
113 | #define CS6 0x00000100 /* 6 bits */ |
114 | #define CS7 0x00000200 /* 7 bits */ | |
115 | #define CS8 0x00000300 /* 8 bits */ | |
116 | #define CSTOPB 0x00000400 /* send 2 stop bits */ | |
117 | #define CREAD 0x00000800 /* enable receiver */ | |
118 | #define PARENB 0x00001000 /* parity enable */ | |
119 | #define PARODD 0x00002000 /* odd parity, else even */ | |
1c15e888 | 120 | #ifndef _POSIX_SOURCE |
47628c26 | 121 | #define HUPCL 0x00004000 /* hang up on last close */ |
1c15e888 | 122 | #endif |
e84b8d0c | 123 | #define CLOCAL 0x00008000 /* ignore modem status lines */ |
f8d4a907 MK |
124 | #ifndef _POSIX_SOURCE |
125 | #define CCTS_OFLOW 0x00010000 /* CTS flow control of output */ | |
126 | #define CRTSCTS CCTS_OFLOW /* ??? */ | |
127 | #define CRTS_IFLOW 0x00020000 /* RTS flow control of input */ | |
128 | #define MDMBUF 0x00100000 /* flow control output via Carrier */ | |
75183d37 | 129 | #endif |
47628c26 MT |
130 | |
131 | ||
132 | /* | |
133 | * "Local" flags - dumping ground for other state | |
134 | * | |
e84b8d0c MT |
135 | * Warning: some flags in this structure begin with |
136 | * the letter "I" and look like they belong in the | |
5c41479c | 137 | * input flag. |
47628c26 MT |
138 | */ |
139 | ||
f8d4a907 | 140 | #ifndef _POSIX_SOURCE |
e84b8d0c | 141 | #define ECHOKE 0x00000001 /* visual erase for line kill */ |
f8d4a907 | 142 | #endif /*_POSIX_SOURCE */ |
47628c26 MT |
143 | #define ECHOE 0x00000002 /* visually erase chars */ |
144 | #define ECHOK 0x00000004 /* echo NL after line kill */ | |
31925d8c | 145 | #define ECHO 0x00000008 /* enable echoing */ |
47628c26 | 146 | #define ECHONL 0x00000010 /* echo NL even if ECHO is off */ |
f8d4a907 | 147 | #ifndef _POSIX_SOURCE |
47628c26 MT |
148 | #define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */ |
149 | #define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */ | |
f8d4a907 | 150 | #endif /*_POSIX_SOURCE */ |
47628c26 MT |
151 | #define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */ |
152 | #define ICANON 0x00000100 /* canonicalize input lines */ | |
f8d4a907 | 153 | #ifndef _POSIX_SOURCE |
e84b8d0c | 154 | #define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */ |
f8d4a907 | 155 | #endif /*_POSIX_SOURCE */ |
325c8cd3 | 156 | #define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */ |
75183d37 | 157 | #define EXTPROC 0x00000800 /* external processing */ |
e84b8d0c | 158 | #define TOSTOP 0x00400000 /* stop background jobs from output */ |
f8d4a907 | 159 | #ifndef _POSIX_SOURCE |
e84b8d0c | 160 | #define FLUSHO 0x00800000 /* output being flushed (state) */ |
40f88ff5 | 161 | #define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */ |
f8d4a907 MK |
162 | #define PENDIN 0x20000000 /* XXX retype pending input (state) */ |
163 | #endif /*_POSIX_SOURCE */ | |
e84b8d0c | 164 | #define NOFLSH 0x80000000 /* don't flush after interrupt */ |
31925d8c MT |
165 | |
166 | typedef unsigned long tcflag_t; | |
167 | typedef unsigned char cc_t; | |
47628c26 MT |
168 | |
169 | struct termios { | |
31925d8c MT |
170 | tcflag_t c_iflag; /* input flags */ |
171 | tcflag_t c_oflag; /* output flags */ | |
172 | tcflag_t c_cflag; /* control flags */ | |
173 | tcflag_t c_lflag; /* local flags */ | |
40f88ff5 | 174 | cc_t c_cc[NCCS]; /* control chars */ |
47628c26 MT |
175 | long c_ispeed; /* input speed */ |
176 | long c_ospeed; /* output speed */ | |
177 | }; | |
178 | ||
179 | /* | |
e84b8d0c | 180 | * Commands passed to tcsetattr() for setting the termios structure. |
47628c26 MT |
181 | */ |
182 | #define TCSANOW 0 /* make change immediate */ | |
183 | #define TCSADRAIN 1 /* drain output, then change */ | |
a6ddfb44 | 184 | #define TCSAFLUSH 2 /* drain output, flush input */ |
627cfa9d MT |
185 | #ifndef _POSIX_SOURCE |
186 | #define TCSASOFT 0x10 /* flag - don't alter h.w. state */ | |
187 | #endif | |
31925d8c | 188 | |
e84b8d0c | 189 | /* |
31925d8c | 190 | * Standard speeds |
e84b8d0c | 191 | */ |
31925d8c MT |
192 | #define B0 0 |
193 | #define B50 50 | |
194 | #define B75 75 | |
195 | #define B110 110 | |
196 | #define B134 134 | |
197 | #define B150 150 | |
198 | #define B200 200 | |
199 | #define B300 300 | |
200 | #define B600 600 | |
201 | #define B1200 1200 | |
202 | #define B1800 1800 | |
203 | #define B2400 2400 | |
204 | #define B4800 4800 | |
205 | #define B9600 9600 | |
206 | #define B19200 19200 | |
207 | #define B38400 38400 | |
f8d4a907 | 208 | #ifndef _POSIX_SOURCE |
31925d8c MT |
209 | #define EXTA 19200 |
210 | #define EXTB 38400 | |
f8d4a907 | 211 | #endif /*_POSIX_SOURCE */ |
47628c26 | 212 | /* |
31925d8c | 213 | * END OF PROTECTED INCLUDE. |
47628c26 | 214 | */ |
31925d8c MT |
215 | #endif /* _TERMIOS_ */ |
216 | ||
217 | #ifndef _POSIX_SOURCE | |
218 | #ifdef KERNEL | |
219 | #include "ttydefaults.h" | |
220 | #else | |
221 | #include <sys/ttydefaults.h> | |
222 | #endif | |
f8d4a907 | 223 | #endif /*_POSIX_SOURCE */ |