Annotation of prex-old/include/sys/termios.h, Revision 1.1.1.1
1.1 nbrk 1: /*
2: * Copyright (c) 1988, 1989, 1993, 1994
3: * The Regents of the University of California. All rights reserved.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: * 3. Neither the name of the University nor the names of its contributors
14: * may be used to endorse or promote products derived from this software
15: * without specific prior written permission.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27: * SUCH DAMAGE.
28: *
29: * @(#)termios.h 8.3 (Berkeley) 3/28/94
30: */
31:
32: #ifndef _SYS_TERMIOS_H_
33: #define _SYS_TERMIOS_H_
34:
35: /*
36: * Special Control Characters
37: *
38: * Index into c_cc[] character array.
39: *
40: * Name Subscript Enabled by
41: */
42: #define VEOF 0 /* ICANON */
43: #define VEOL 1 /* ICANON */
44: #define VEOL2 2 /* ICANON */
45: #define VERASE 3 /* ICANON */
46: #define VWERASE 4 /* ICANON */
47: #define VKILL 5 /* ICANON */
48: #define VREPRINT 6 /* ICANON */
49: /* 7 spare 1 */
50: #define VINTR 8 /* ISIG */
51: #define VQUIT 9 /* ISIG */
52: #define VSUSP 10 /* ISIG */
53: #define VDSUSP 11 /* ISIG */
54: #define VSTART 12 /* IXON, IXOFF */
55: #define VSTOP 13 /* IXON, IXOFF */
56: #define VLNEXT 14 /* IEXTEN */
57: #define VDISCARD 15 /* IEXTEN */
58: #define VMIN 16 /* !ICANON */
59: #define VTIME 17 /* !ICANON */
60: #define VSTATUS 18 /* ICANON */
61: /* 19 spare 2 */
62: #define NCCS 20
63:
64: #define _POSIX_VDISABLE ((unsigned char)'\377')
65:
66: #define CCEQ(val, c) (c == val ? val != _POSIX_VDISABLE : 0)
67:
68: /*
69: * Input flags - software input processing
70: */
71: #define IGNBRK 0x00000001 /* ignore BREAK condition */
72: #define BRKINT 0x00000002 /* map BREAK to SIGINTR */
73: #define IGNPAR 0x00000004 /* ignore (discard) parity errors */
74: #define PARMRK 0x00000008 /* mark parity and framing errors */
75: #define INPCK 0x00000010 /* enable checking of parity errors */
76: #define ISTRIP 0x00000020 /* strip 8th bit off chars */
77: #define INLCR 0x00000040 /* map NL into CR */
78: #define IGNCR 0x00000080 /* ignore CR */
79: #define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */
80: #define IXON 0x00000200 /* enable output flow control */
81: #define IXOFF 0x00000400 /* enable input flow control */
82: #define IXANY 0x00000800 /* any char will restart after stop */
83: #define IMAXBEL 0x00002000 /* ring bell on input queue full */
84:
85: /*
86: * Output flags - software output processing
87: */
88: #define OPOST 0x00000001 /* enable following output processing */
89: #define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */
90: #define OXTABS 0x00000004 /* expand tabs to spaces */
91: #define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */
92:
93: /*
94: * Control flags - hardware control of terminal
95: */
96: #define CIGNORE 0x00000001 /* ignore control flags */
97: #define CSIZE 0x00000300 /* character size mask */
98: #define CS5 0x00000000 /* 5 bits (pseudo) */
99: #define CS6 0x00000100 /* 6 bits */
100: #define CS7 0x00000200 /* 7 bits */
101: #define CS8 0x00000300 /* 8 bits */
102: #define CSTOPB 0x00000400 /* send 2 stop bits */
103: #define CREAD 0x00000800 /* enable receiver */
104: #define PARENB 0x00001000 /* parity enable */
105: #define PARODD 0x00002000 /* odd parity, else even */
106: #define HUPCL 0x00004000 /* hang up on last close */
107: #define CLOCAL 0x00008000 /* ignore modem status lines */
108: #define CCTS_OFLOW 0x00010000 /* CTS flow control of output */
109: #define CRTSCTS CCTS_OFLOW /* ??? */
110: #define CRTS_IFLOW 0x00020000 /* RTS flow control of input */
111: #define MDMBUF 0x00100000 /* flow control output via Carrier */
112:
113:
114: /*
115: * "Local" flags - dumping ground for other state
116: *
117: * Warning: some flags in this structure begin with
118: * the letter "I" and look like they belong in the
119: * input flag.
120: */
121:
122: #ifndef _POSIX_SOURCE
123: #define ECHOKE 0x00000001 /* visual erase for line kill */
124: #endif /*_POSIX_SOURCE */
125: #define ECHOE 0x00000002 /* visually erase chars */
126: #define ECHOK 0x00000004 /* echo NL after line kill */
127: #define ECHO 0x00000008 /* enable echoing */
128: #define ECHONL 0x00000010 /* echo NL even if ECHO is off */
129: #ifndef _POSIX_SOURCE
130: #define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */
131: #define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */
132: #endif /*_POSIX_SOURCE */
133: #define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */
134: #define ICANON 0x00000100 /* canonicalize input lines */
135: #ifndef _POSIX_SOURCE
136: #define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */
137: #endif /*_POSIX_SOURCE */
138: #define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */
139: #define EXTPROC 0x00000800 /* external processing */
140: #define TOSTOP 0x00400000 /* stop background jobs from output */
141: #ifndef _POSIX_SOURCE
142: #define FLUSHO 0x00800000 /* output being flushed (state) */
143: #define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */
144: #define PENDIN 0x20000000 /* XXX retype pending input (state) */
145: #endif /*_POSIX_SOURCE */
146: #define NOFLSH 0x80000000 /* don't flush after interrupt */
147:
148: typedef unsigned long tcflag_t;
149: typedef unsigned char cc_t;
150: typedef long speed_t;
151:
152: struct termios {
153: tcflag_t c_iflag; /* input flags */
154: tcflag_t c_oflag; /* output flags */
155: tcflag_t c_cflag; /* control flags */
156: tcflag_t c_lflag; /* local flags */
157: cc_t c_cc[NCCS]; /* control chars */
158: long c_ispeed; /* input speed */
159: long c_ospeed; /* output speed */
160: };
161:
162: /*
163: * Commands passed to tcsetattr() for setting the termios structure.
164: */
165: #define TCSANOW 0 /* make change immediate */
166: #define TCSADRAIN 1 /* drain output, then change */
167: #define TCSAFLUSH 2 /* drain output, flush input */
168: #ifndef _POSIX_SOURCE
169: #define TCSASOFT 0x10 /* flag - don't alter h.w. state */
170: #endif
171:
172: /*
173: * Standard speeds
174: */
175: #define B0 0
176: #define B50 50
177: #define B75 75
178: #define B110 110
179: #define B134 134
180: #define B150 150
181: #define B200 200
182: #define B300 300
183: #define B600 600
184: #define B1200 1200
185: #define B1800 1800
186: #define B2400 2400
187: #define B4800 4800
188: #define B9600 9600
189: #define B19200 19200
190: #define B38400 38400
191:
192: #ifndef KERNEL
193:
194: #define TCIFLUSH 1
195: #define TCOFLUSH 2
196: #define TCIOFLUSH 3
197: #define TCOOFF 1
198: #define TCOON 2
199: #define TCIOFF 3
200: #define TCION 4
201:
202: #include <sys/cdefs.h>
203:
204: __BEGIN_DECLS
205: speed_t cfgetispeed(const struct termios *);
206: speed_t cfgetospeed(const struct termios *);
207: int cfsetispeed(struct termios *, speed_t);
208: int cfsetospeed(struct termios *, speed_t);
209: int tcgetattr(int, struct termios *);
210: int tcsetattr(int, int, const struct termios *);
211: int tcdrain(int);
212: int tcflow(int, int);
213: int tcflush(int, int);
214: int tcsendbreak(int, int);
215:
216: #ifndef _POSIX_SOURCE
217: void cfmakeraw(struct termios *);
218: int cfsetspeed(struct termios *, speed_t);
219: #endif /* !_POSIX_SOURCE */
220: __END_DECLS
221:
222: #endif /* !KERNEL */
223:
224: #ifndef _POSIX_SOURCE
225:
226: /*
227: * Include tty ioctl's that aren't just for backwards compatibility
228: * with the old tty driver. These ioctl definitions were previously
229: * in <sys/ioctl.h>.
230: */
231: #include <sys/ttycom.h>
232: #endif
233:
234: /*
235: * END OF PROTECTED INCLUDE.
236: */
237: #endif /* !_SYS_TERMIOS_H_ */
238:
239: #ifndef _POSIX_SOURCE
240: #include <sys/ttydefaults.h>
241: #endif
CVSweb