1 /****************************************************************************
2 * Copyright 2018,2020 Thomas E. Dickey *
3 * Copyright 2011-2014,2017 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 /****************************************************************************
31 * Author: Thomas E. Dickey 2011 *
32 ****************************************************************************/
34 /* $Id: nc_termios.h,v 1.7 2020/02/02 23:34:34 tom Exp $ */
36 #ifndef NC_TERMIOS_included
37 #define NC_TERMIOS_included 1
39 #include <ncurses_cfg.h>
41 #if HAVE_TERMIOS_H && HAVE_TCGETATTR
43 #else /* !HAVE_TERMIOS_H */
47 /* Add definitions to make termio look like termios.
48 * But ifdef it, since there are some implementations
49 * that try to do this for us in a fake <termio.h>.
52 #define TCSADRAIN TCSETAW
55 #define TCSAFLUSH TCSETAF
58 #define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
61 #define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)
64 #define cfgetospeed(t) ((t)->c_cflag & CBAUD)
70 #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
73 #else /* !HAVE_TERMIO_H */
96 #define IGNBRK 0x00001
97 #define BRKINT 0x00002
98 #define IGNPAR 0x00004
100 #define ISTRIP 0x00020
101 #define INLCR 0x00040
102 #define IGNCR 0x00080
103 #define ICRNL 0x00100
105 #define IXOFF 0x01000
106 #define PARMRK 0x10000
109 #define OPOST 0x00001
112 #define CBAUD 0x0100f
122 #define B1200 0x00009
123 #define B1800 0x0000a
124 #define B2400 0x0000b
125 #define B4800 0x0000c
126 #define B9600 0x0000d
128 #define CSIZE 0x00030
130 #define CSTOPB 0x00040
131 #define CREAD 0x00080
132 #define PARENB 0x00100
133 #define PARODD 0x00200
134 #define HUPCL 0x00400
135 #define CLOCAL 0x00800
141 #define cfgetospeed(t) ((t)->c_cflag & CBAUD)
145 #define tcsetattr(fd, opt, arg) _nc_mingw_tcsetattr(fd, opt, arg)
149 #define tcgetattr(fd, arg) _nc_mingw_tcgetattr(fd, arg)
153 #define tcflush(fd, queue) _nc_mingw_tcflush(fd, queue)
157 #define ttyname(fd) NULL
160 #endif /* HAVE_TERMIO_H */
162 #endif /* HAVE_TERMIOS_H */
164 #endif /* NC_TERMIOS_included */