summaryrefslogtreecommitdiffstats
path: root/contrib/ncurses/include/nc_termios.h
blob: 5a6360698b2a5e7a28d0487d333a01a02e09291f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/****************************************************************************
 * Copyright (c) 2011 Free Software Foundation, Inc.                        *
 *                                                                          *
 * Permission is hereby granted, free of charge, to any person obtaining a  *
 * copy of this software and associated documentation files (the            *
 * "Software"), to deal in the Software without restriction, including      *
 * without limitation the rights to use, copy, modify, merge, publish,      *
 * distribute, distribute with modifications, sublicense, and/or sell       *
 * copies of the Software, and to permit persons to whom the Software is    *
 * furnished to do so, subject to the following conditions:                 *
 *                                                                          *
 * The above copyright notice and this permission notice shall be included  *
 * in all copies or substantial portions of the Software.                   *
 *                                                                          *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
 *                                                                          *
 * Except as contained in this notice, the name(s) of the above copyright   *
 * holders shall not be used in advertising or otherwise to promote the     *
 * sale, use or other dealings in this Software without prior written       *
 * authorization.                                                           *
 ****************************************************************************/

/****************************************************************************
 *  Author: Thomas E. Dickey                        2011                    *
 ****************************************************************************/

/* $Id: nc_termios.h,v 1.2 2011/06/25 20:44:05 tom Exp $ */

#ifndef NC_TERMIOS_included
#define NC_TERMIOS_included 1

#if HAVE_TERMIOS_H && HAVE_TCGETATTR

#else /* !HAVE_TERMIOS_H */

#if HAVE_TERMIO_H

/* Add definitions to make termio look like termios.
 * But ifdef it, since there are some implementations
 * that try to do this for us in a fake <termio.h>.
 */
#ifndef TCSADRAIN
#define TCSADRAIN TCSETAW
#endif
#ifndef TCSAFLUSH
#define TCSAFLUSH TCSETAF
#endif
#ifndef tcsetattr
#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
#endif
#ifndef tcgetattr
#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)
#endif
#ifndef cfgetospeed
#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
#endif
#ifndef TCIFLUSH
#define TCIFLUSH 0
#endif
#ifndef tcflush
#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
#endif

#else /* !HAVE_TERMIO_H */

#if __MINGW32__

/* c_cc chars */
#define VINTR     0
#define VQUIT     1
#define VERASE    2
#define VKILL     3
#define VEOF      4
#define VTIME     5
#define VMIN      6

/* c_iflag bits */
#define ISTRIP	0000040
#define INLCR	0000100
#define IGNCR	0000200
#define ICRNL	0000400
#define BRKINT	0000002
#define PARMRK	0000010
#define IXON	0002000
#define IGNBRK	0000001
#define IGNPAR	0000004
#define INPCK	0000020
#define IXOFF	0010000

/* c_oflag bits */
#define OPOST	0000001

/* c_cflag bit meaning */
#define CBAUD	   0010017
#define CSIZE	   0000060
#define CS8	   0000060
#define B0	   0000000
#define B50	   0000001
#define B75	   0000002
#define B110	   0000003
#define B134	   0000004
#define B150	   0000005
#define B200	   0000006
#define B300	   0000007
#define B600	   0000010
#define B1200	   0000011
#define B1800	   0000012
#define B2400	   0000013
#define B4800	   0000014
#define B9600	   0000015
#define CLOCAL	   0004000
#define CREAD	   0000200
#define CSTOPB	   0000100
#define HUPCL	   0002000
#define PARENB	   0000400
#define PARODD	   0001000

/* c_lflag bits */
#define ECHO	0000010
#define ECHONL	0000100
#define ISIG	0000001
#define IEXTEN	0100000
#define ICANON	0000002
#define NOFLSH	0000200
#define ECHOE	0000020
#define ECHOK	0000040

/* tcflush() */
#define	TCIFLUSH	0

/* tcsetattr uses these */
#define	TCSADRAIN	1

/* ioctls */
#define TCGETA		0x5405
#define TCFLSH		0x540B
#define TIOCGWINSZ	0x5413

#ifndef cfgetospeed
#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
#endif

#ifndef tcsetattr
#define tcsetattr(fd, cmd, arg) _nc_mingw_ioctl(fd, cmd, arg)
#endif

#ifndef tcgetattr
#define tcgetattr(fd, arg) _nc_mingw_ioctl(fd, TCGETA, arg)
#endif

#ifndef tcflush
#define tcflush(fd, arg) _nc_mingw_ioctl(fd, TCFLSH, arg)
#endif

#undef  ttyname
#define ttyname(fd) NULL

#else

#endif /* __MINGW32__ */
#endif /* HAVE_TERMIO_H */

#endif /* HAVE_TERMIOS_H */

#endif /* NC_TERMIOS_included */
OpenPOWER on IntegriCloud