1 /****************************************************************************
2 * Copyright (c) 2011 Free Software Foundation, Inc. *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
27 ****************************************************************************/
29 /****************************************************************************
30 * Author: Thomas E. Dickey 2011 *
31 ****************************************************************************/
33 /* $Id: nc_termios.h,v 1.2 2011/06/25 20:44:05 tom Exp $ */
35 #ifndef NC_TERMIOS_included
36 #define NC_TERMIOS_included 1
38 #if HAVE_TERMIOS_H && HAVE_TCGETATTR
40 #else /* !HAVE_TERMIOS_H */
44 /* Add definitions to make termio look like termios.
45 * But ifdef it, since there are some implementations
46 * that try to do this for us in a fake <termio.h>.
49 #define TCSADRAIN TCSETAW
52 #define TCSAFLUSH TCSETAF
55 #define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
58 #define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)
61 #define cfgetospeed(t) ((t)->c_cflag & CBAUD)
67 #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
70 #else /* !HAVE_TERMIO_H */
84 #define ISTRIP 0000040
88 #define BRKINT 0000002
89 #define PARMRK 0000010
91 #define IGNBRK 0000001
92 #define IGNPAR 0000004
99 /* c_cflag bit meaning */
100 #define CBAUD 0010017
101 #define CSIZE 0000060
112 #define B1200 0000011
113 #define B1800 0000012
114 #define B2400 0000013
115 #define B4800 0000014
116 #define B9600 0000015
117 #define CLOCAL 0004000
118 #define CREAD 0000200
119 #define CSTOPB 0000100
120 #define HUPCL 0002000
121 #define PARENB 0000400
122 #define PARODD 0001000
126 #define ECHONL 0000100
128 #define IEXTEN 0100000
129 #define ICANON 0000002
130 #define NOFLSH 0000200
131 #define ECHOE 0000020
132 #define ECHOK 0000040
137 /* tcsetattr uses these */
141 #define TCGETA 0x5405
142 #define TCFLSH 0x540B
143 #define TIOCGWINSZ 0x5413
146 #define cfgetospeed(t) ((t)->c_cflag & CBAUD)
150 #define tcsetattr(fd, cmd, arg) _nc_mingw_ioctl(fd, cmd, arg)
154 #define tcgetattr(fd, arg) _nc_mingw_ioctl(fd, TCGETA, arg)
158 #define tcflush(fd, arg) _nc_mingw_ioctl(fd, TCFLSH, arg)
162 #define ttyname(fd) NULL
166 #endif /* __MINGW32__ */
167 #endif /* HAVE_TERMIO_H */
169 #endif /* HAVE_TERMIOS_H */
171 #endif /* NC_TERMIOS_included */