]> ncurses.scripts.mit.edu Git - ncurses.git/blob - include/nc_termios.h
ncurses 6.0 - patch 20171125
[ncurses.git] / include / nc_termios.h
1 /****************************************************************************
2  * Copyright (c) 2011-2014,2017 Free Software Foundation, Inc.              *
3  *                                                                          *
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:                 *
11  *                                                                          *
12  * The above copyright notice and this permission notice shall be included  *
13  * in all copies or substantial portions of the Software.                   *
14  *                                                                          *
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.                               *
22  *                                                                          *
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       *
26  * authorization.                                                           *
27  ****************************************************************************/
28
29 /****************************************************************************
30  *  Author: Thomas E. Dickey                        2011                    *
31  ****************************************************************************/
32
33 /* $Id: nc_termios.h,v 1.5 2017/07/23 00:02:08 tom Exp $ */
34
35 #ifndef NC_TERMIOS_included
36 #define NC_TERMIOS_included 1
37
38 #include <ncurses_cfg.h>
39
40 #if HAVE_TERMIOS_H && HAVE_TCGETATTR
41
42 #else /* !HAVE_TERMIOS_H */
43
44 #if HAVE_TERMIO_H
45
46 /* Add definitions to make termio look like termios.
47  * But ifdef it, since there are some implementations
48  * that try to do this for us in a fake <termio.h>.
49  */
50 #ifndef TCSADRAIN
51 #define TCSADRAIN TCSETAW
52 #endif
53 #ifndef TCSAFLUSH
54 #define TCSAFLUSH TCSETAF
55 #endif
56 #ifndef tcsetattr
57 #define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
58 #endif
59 #ifndef tcgetattr
60 #define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)
61 #endif
62 #ifndef cfgetospeed
63 #define cfgetospeed(t) ((t)->c_cflag & CBAUD)
64 #endif
65 #ifndef TCIFLUSH
66 #define TCIFLUSH 0
67 #endif
68 #ifndef tcflush
69 #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
70 #endif
71
72 #else /* !HAVE_TERMIO_H */
73
74 #if __MINGW32__
75
76 /* lflag bits */
77 #define ISIG    0x0001
78 #define ICANON  0x0002
79 #define ECHO    0x0004
80 #define ECHOE   0x0008
81 #define ECHOK   0x0010
82 #define ECHONL  0x0020
83 #define NOFLSH  0x0040
84 #define IEXTEN  0x0100
85
86 #define VEOF         4
87 #define VERASE       5
88 #define VINTR        6
89 #define VKILL        7
90 #define VMIN         9
91 #define VQUIT       10
92 #define VTIME       16
93
94 /* iflag bits */
95 #define IGNBRK  0x00001
96 #define BRKINT  0x00002
97 #define IGNPAR  0x00004
98 #define INPCK   0x00010
99 #define ISTRIP  0x00020
100 #define INLCR   0x00040
101 #define IGNCR   0x00080
102 #define ICRNL   0x00100
103 #define IXON    0x00400
104 #define IXOFF   0x01000
105 #define PARMRK  0x10000
106
107 /* oflag bits */
108 #define OPOST   0x00001
109
110 /* cflag bits */
111 #define CBAUD    0x0100f
112 #define B0       0x00000
113 #define B50      0x00001
114 #define B75      0x00002
115 #define B110     0x00003
116 #define B134     0x00004
117 #define B150     0x00005
118 #define B200     0x00006
119 #define B300     0x00007
120 #define B600     0x00008
121 #define B1200    0x00009
122 #define B1800    0x0000a
123 #define B2400    0x0000b
124 #define B4800    0x0000c
125 #define B9600    0x0000d
126
127 #define CSIZE    0x00030
128 #define CS8      0x00030
129 #define CSTOPB   0x00040
130 #define CREAD    0x00080
131 #define PARENB   0x00100
132 #define PARODD   0x00200
133 #define HUPCL    0x00400
134 #define CLOCAL   0x00800
135
136 #define TCIFLUSH        0
137 #define TCSADRAIN       3
138
139 #ifndef cfgetospeed
140 #define cfgetospeed(t) ((t)->c_cflag & CBAUD)
141 #endif
142
143 #ifndef tcsetattr
144 #define tcsetattr(fd, opt, arg) _nc_mingw_tcsetattr(fd, opt, arg)
145 #endif
146
147 #ifndef tcgetattr
148 #define tcgetattr(fd, arg) _nc_mingw_tcgetattr(fd, arg)
149 #endif
150
151 #ifndef tcflush
152 #define tcflush(fd, queue) _nc_mingw_tcflush(fd, queue)
153 #endif
154
155 #undef  ttyname
156 #define ttyname(fd) NULL
157
158 #endif /* __MINGW32__ */
159 #endif /* HAVE_TERMIO_H */
160
161 #endif /* HAVE_TERMIOS_H */
162
163 #endif /* NC_TERMIOS_included */