Install msysDVLPR-1.0.0-alpha-1
[msysgit.git] / include / sys / termios.h
bloba87f10627fc2a0c690c5487f889f6f59e4446621
1 /* sys/termios.h
3 Copyright 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
9 details. */
11 /* sys/termios.h */
13 #ifndef _SYS_TERMIOS_H
14 #define _SYS_TERMIOS_H
16 #define TCOOFF 0
17 #define TCOON 1
18 #define TCIOFF 2
19 #define TCION 3
21 #define TCGETA 5
22 #define TCSETA 6
23 #define TCSETAW 7
24 #define TCSETAF 8
26 #define TCIFLUSH 0
27 #define TCOFLUSH 1
28 #define TCIOFLUSH 2
29 #define TCFLSH 3
31 #define TCSAFLUSH 1
32 #define TCSANOW 2
33 #define TCSADRAIN 3
34 #define TCSADFLUSH 4
36 #define TIOCPKT 6
38 #define TIOCPKT_DATA 0
39 #define TIOCPKT_FLUSHREAD 1
40 #define TIOCPKT_FLUSHWRITE 2
41 #define TIOCPKT_STOP 4
42 #define TIOCPKT_START 8
43 #define TIOCPKT_NOSTOP 16
44 #define TIOCPKT_DOSTOP 32
46 #define FIONBIO 0x8004667e /* To be compatible with socket version */
48 #define CTRL(ch) ((ch)&0x1F)
50 #define CNUL 0
51 #define CDEL 0x0007f
52 #define CESC '\\'
53 #define CINTR CTRL('C')
54 #define CQUIT 0x0001c
55 #define CERASE CTRL('H')
56 #define CKILL CTRL('U')
57 #define CEOT CTRL('D')
58 #define CEOL 0
59 #define CEOL2 0
60 #define CEOF CTRL('D')
61 #define CSTART CTRL('Q')
62 #define CSTOP CTRL('S')
63 #define CSWTCH 0x0001a
64 #define NSWTCH 0
65 #define CSUSP CTRL('Z')
66 #define CDSUSP CTRL('Y')
67 #define CRPRNT CTRL('R')
68 #define CFLUSH CTRL('O')
69 #define CWERASE CTRL('W')
70 #define CLNEXT CTRL('V')
72 /* iflag bits */
73 #define IGNBRK 0x00001
74 #define BRKINT 0x00002
75 #define IGNPAR 0x00004
76 #define IMAXBEL 0x00008
77 #define INPCK 0x00010
78 #define ISTRIP 0x00020
79 #define INLCR 0x00040
80 #define IGNCR 0x00080
81 #define ICRNL 0x00100
82 #define IXON 0x00400
83 #define IXOFF 0x01000
84 #define IUCLC 0x04000
85 #define IXANY 0x08000
86 #define PARMRK 0x10000
88 /* oflag bits */
90 #define OPOST 0x00001
91 #define OLCUC 0x00002
92 #define OCRNL 0x00004
93 #define ONLCR 0x00008
94 #define ONOCR 0x00010
95 #define ONLRET 0x00020
96 #define OFILL 0x00040
97 #define CRDLY 0x00180
98 #define CR0 0x00000
99 #define CR1 0x00080
100 #define CR2 0x00100
101 #define CR3 0x00180
102 #define NLDLY 0x00200
103 #define NL0 0x00000
104 #define NL1 0x00200
105 #define BSDLY 0x00400
106 #define BS0 0x00000
107 #define BS1 0x00400
108 #define TABDLY 0x01800
109 #define TAB0 0x00000
110 #define TAB1 0x00800
111 #define TAB2 0x01000
112 #define TAB3 0x01800
113 #define XTABS 0x01800
114 #define VTDLY 0x02000
115 #define VT0 0x00000
116 #define VT1 0x02000
117 #define FFDLY 0x04000
118 #define FF0 0x00000
119 #define FF1 0x04000
120 #define OFDEL 0x08000
122 /* cflag bits */
124 /* Baud rate values. These must fit in speed_t, which is unsigned
125 char. See also the extended baud rates below. These baud rates
126 set an additional bit. */
127 #define CBAUD 0x0100f
128 #define B0 0x00000
129 #define B50 0x00001
130 #define B75 0x00002
131 #define B110 0x00003
132 #define B134 0x00004
133 #define B150 0x00005
134 #define B200 0x00006
135 #define B300 0x00007
136 #define B600 0x00008
137 #define B1200 0x00009
138 #define B1800 0x0000a
139 #define B2400 0x0000b
140 #define B4800 0x0000c
141 #define B9600 0x0000d
142 #define B19200 0x0000e
143 #define B38400 0x0000f
145 #define CSIZE 0x00030
146 #define CS5 0x00000
147 #define CS6 0x00010
148 #define CS7 0x00020
149 #define CS8 0x00030
150 #define CSTOPB 0x00040
151 #define CREAD 0x00080
152 #define PARENB 0x00100
153 #define PARODD 0x00200
154 #define HUPCL 0x00400
155 #define CLOCAL 0x00800
156 #define CBAUDEX 0x0100f
157 #define B57600 0x01001
158 #define B115200 0x01002
159 #define B128000 0x01003
160 #define B256000 0x01003
161 #define CRTSXOFF 0x04000
162 #define CRTSCTS 0x08000
164 /* lflag bits */
165 #define ISIG 0x0001
166 #define ICANON 0x0002
167 #define ECHO 0x0004
168 #define ECHOE 0x0008
169 #define ECHOK 0x0010
170 #define ECHONL 0x0020
171 #define NOFLSH 0x0040
172 #define TOSTOP 0x0080
173 #define IEXTEN 0x0100
174 #define FLUSHO 0x0200
175 #define ECHOKE 0x0400
176 #define ECHOCTL 0x0800
178 #define VDISCARD 1
179 #define VEOL 2
180 #define VEOL2 3
181 #define VEOF 4
182 #define VERASE 5
183 #define VINTR 6
184 #define VKILL 7
185 #define VLNEXT 8
186 #define VMIN 9
187 #define VQUIT 10
188 #define VREPRINT 11
189 #define VSTART 12
190 #define VSTOP 13
191 #define VSUSP 14
192 #define VSWTC 15
193 #define VTIME 16
194 #define VWERASE 17
196 #define NCCS 18
198 typedef unsigned char cc_t;
199 typedef unsigned int tcflag_t;
200 typedef unsigned int speed_t;
201 typedef unsigned short otcflag_t;
202 typedef unsigned char ospeed_t;
204 struct __oldtermios {
205 otcflag_t c_iflag;
206 otcflag_t c_oflag;
207 otcflag_t c_cflag;
208 otcflag_t c_lflag;
209 char c_line;
210 cc_t c_cc[NCCS];
211 ospeed_t c_ispeed;
212 ospeed_t c_ospeed;
215 struct termios {
216 tcflag_t c_iflag;
217 tcflag_t c_oflag;
218 tcflag_t c_cflag;
219 tcflag_t c_lflag;
220 char c_line;
221 cc_t c_cc[NCCS];
222 speed_t c_ispeed;
223 speed_t c_ospeed;
226 #ifdef CYGWIN_VERSION_DLL_IS_OLD_TERMIOS
227 #ifdef __GNUC__
228 # define __tonew_termios(ti) \
229 ({ \
230 struct termios *__newti; \
232 if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \
233 __newti = (struct termios *) ti; \
234 else \
236 __newti = (struct termios *) alloca(sizeof(struct termios)); \
237 __newti->c_iflag = ((struct __oldtermios *)ti)->c_iflag; \
238 __newti->c_oflag = ((struct __oldtermios *)ti)->c_oflag; \
239 __newti->c_cflag = ((struct __oldtermios *)ti)->c_cflag; \
240 __newti->c_lflag = ((struct __oldtermios *)ti)->c_lflag; \
241 __newti->c_line = ((struct __oldtermios *)ti)->c_line; \
242 __newti->c_ispeed = ((struct __oldtermios *)ti)->c_ispeed; \
243 __newti->c_ospeed = ((struct __oldtermios *)ti)->c_ospeed; \
244 memcpy (__newti->c_cc, ((struct __oldtermios *)ti)->c_cc, sizeof(__newti->c_cc)); \
246 __newti; \
249 # define __makenew_termios(ti) \
250 (CYGWIN_VERSION_DLL_IS_OLD_TERMIOS ? \
251 (struct termios *) alloca (sizeof (struct termios)) : (ti))
253 # define __toapp_termios(toti, fromti) \
254 ({ \
255 if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \
256 toti = fromti; \
257 else \
259 ((struct __oldtermios *)toti)->c_iflag = fromti->c_iflag; \
260 ((struct __oldtermios *)toti)->c_oflag = fromti->c_oflag; \
261 ((struct __oldtermios *)toti)->c_cflag = fromti->c_cflag; \
262 ((struct __oldtermios *)toti)->c_lflag = fromti->c_lflag; \
263 ((struct __oldtermios *)toti)->c_line = fromti->c_line; \
264 ((struct __oldtermios *)toti)->c_ispeed = fromti->c_ispeed; \
265 ((struct __oldtermios *)toti)->c_ospeed = fromti->c_ospeed; \
266 memcpy (((struct __oldtermios*)toti)->c_cc, fromti->c_cc, sizeof(fromti->c_cc)); \
268 toti; \
270 #endif /*__GNUC__*/
271 #endif
273 #define termio termios
275 #define cfgetospeed(tp) ((tp)->c_ospeed)
276 #define cfgetispeed(tp) ((tp)->c_ispeed)
277 #define cfsetospeed(tp,s) (((tp)->c_ospeed = (s)), 0)
278 #define cfsetispeed(tp,s) (((tp)->c_ispeed = (s)), 0)
280 #ifdef __cplusplus
281 extern "C" {
282 #endif
284 int tcgetattr (int, struct termios *);
285 int tcsetattr (int, int, const struct termios *);
286 int tcsendbreak (int, int);
287 int tcdrain (int);
288 int tcflush (int, int);
289 int tcflow (int, int);
291 #ifdef __cplusplus
293 #endif
295 /* Extra stuff to make porting stuff easier. */
296 struct winsize
298 unsigned short ws_row, ws_col;
299 unsigned short ws_xpixel, ws_ypixel;
302 #define TIOCGWINSZ (('T' << 8) | 1)
303 #define TIOCSWINSZ (('T' << 8) | 2)
305 #endif /* _SYS_TERMIOS_H */