13468e90cSJohn Marino /****************************************************************************
2*32bb5217SDaniel Fojt  * Copyright 2018,2020 Thomas E. Dickey                                     *
3*32bb5217SDaniel Fojt  * Copyright 2011-2014,2017 Free Software Foundation, Inc.                  *
43468e90cSJohn Marino  *                                                                          *
53468e90cSJohn Marino  * Permission is hereby granted, free of charge, to any person obtaining a  *
63468e90cSJohn Marino  * copy of this software and associated documentation files (the            *
73468e90cSJohn Marino  * "Software"), to deal in the Software without restriction, including      *
83468e90cSJohn Marino  * without limitation the rights to use, copy, modify, merge, publish,      *
93468e90cSJohn Marino  * distribute, distribute with modifications, sublicense, and/or sell       *
103468e90cSJohn Marino  * copies of the Software, and to permit persons to whom the Software is    *
113468e90cSJohn Marino  * furnished to do so, subject to the following conditions:                 *
123468e90cSJohn Marino  *                                                                          *
133468e90cSJohn Marino  * The above copyright notice and this permission notice shall be included  *
143468e90cSJohn Marino  * in all copies or substantial portions of the Software.                   *
153468e90cSJohn Marino  *                                                                          *
163468e90cSJohn Marino  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
173468e90cSJohn Marino  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
183468e90cSJohn Marino  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
193468e90cSJohn Marino  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
203468e90cSJohn Marino  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
213468e90cSJohn Marino  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
223468e90cSJohn Marino  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
233468e90cSJohn Marino  *                                                                          *
243468e90cSJohn Marino  * Except as contained in this notice, the name(s) of the above copyright   *
253468e90cSJohn Marino  * holders shall not be used in advertising or otherwise to promote the     *
263468e90cSJohn Marino  * sale, use or other dealings in this Software without prior written       *
273468e90cSJohn Marino  * authorization.                                                           *
283468e90cSJohn Marino  ****************************************************************************/
293468e90cSJohn Marino 
303468e90cSJohn Marino /****************************************************************************
313468e90cSJohn Marino  *  Author: Thomas E. Dickey                        2011                    *
323468e90cSJohn Marino  ****************************************************************************/
333468e90cSJohn Marino 
34*32bb5217SDaniel Fojt /* $Id: nc_termios.h,v 1.7 2020/02/02 23:34:34 tom Exp $ */
353468e90cSJohn Marino 
363468e90cSJohn Marino #ifndef NC_TERMIOS_included
373468e90cSJohn Marino #define NC_TERMIOS_included 1
383468e90cSJohn Marino 
39*32bb5217SDaniel Fojt #include <ncurses_cfg.h>
40*32bb5217SDaniel Fojt 
413468e90cSJohn Marino #if HAVE_TERMIOS_H && HAVE_TCGETATTR
423468e90cSJohn Marino 
433468e90cSJohn Marino #else /* !HAVE_TERMIOS_H */
443468e90cSJohn Marino 
453468e90cSJohn Marino #if HAVE_TERMIO_H
463468e90cSJohn Marino 
473468e90cSJohn Marino /* Add definitions to make termio look like termios.
483468e90cSJohn Marino  * But ifdef it, since there are some implementations
493468e90cSJohn Marino  * that try to do this for us in a fake <termio.h>.
503468e90cSJohn Marino  */
513468e90cSJohn Marino #ifndef TCSADRAIN
523468e90cSJohn Marino #define TCSADRAIN TCSETAW
533468e90cSJohn Marino #endif
543468e90cSJohn Marino #ifndef TCSAFLUSH
553468e90cSJohn Marino #define TCSAFLUSH TCSETAF
563468e90cSJohn Marino #endif
573468e90cSJohn Marino #ifndef tcsetattr
583468e90cSJohn Marino #define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
593468e90cSJohn Marino #endif
603468e90cSJohn Marino #ifndef tcgetattr
613468e90cSJohn Marino #define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)
623468e90cSJohn Marino #endif
633468e90cSJohn Marino #ifndef cfgetospeed
643468e90cSJohn Marino #define cfgetospeed(t) ((t)->c_cflag & CBAUD)
653468e90cSJohn Marino #endif
663468e90cSJohn Marino #ifndef TCIFLUSH
673468e90cSJohn Marino #define TCIFLUSH 0
683468e90cSJohn Marino #endif
693468e90cSJohn Marino #ifndef tcflush
703468e90cSJohn Marino #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
713468e90cSJohn Marino #endif
723468e90cSJohn Marino 
733468e90cSJohn Marino #else /* !HAVE_TERMIO_H */
743468e90cSJohn Marino 
75*32bb5217SDaniel Fojt #if _WIN32
763468e90cSJohn Marino 
773468e90cSJohn Marino /* lflag bits */
783468e90cSJohn Marino #define ISIG	0x0001
793468e90cSJohn Marino #define ICANON	0x0002
803468e90cSJohn Marino #define ECHO	0x0004
813468e90cSJohn Marino #define ECHOE	0x0008
823468e90cSJohn Marino #define ECHOK	0x0010
833468e90cSJohn Marino #define ECHONL	0x0020
843468e90cSJohn Marino #define NOFLSH	0x0040
853468e90cSJohn Marino #define IEXTEN	0x0100
863468e90cSJohn Marino 
873468e90cSJohn Marino #define VEOF	     4
883468e90cSJohn Marino #define VERASE	     5
893468e90cSJohn Marino #define VINTR	     6
903468e90cSJohn Marino #define VKILL	     7
913468e90cSJohn Marino #define VMIN	     9
923468e90cSJohn Marino #define VQUIT	    10
933468e90cSJohn Marino #define VTIME	    16
943468e90cSJohn Marino 
953468e90cSJohn Marino /* iflag bits */
963468e90cSJohn Marino #define IGNBRK	0x00001
973468e90cSJohn Marino #define BRKINT	0x00002
983468e90cSJohn Marino #define IGNPAR	0x00004
993468e90cSJohn Marino #define INPCK	0x00010
1003468e90cSJohn Marino #define ISTRIP	0x00020
1013468e90cSJohn Marino #define INLCR	0x00040
1023468e90cSJohn Marino #define IGNCR	0x00080
1033468e90cSJohn Marino #define ICRNL	0x00100
1043468e90cSJohn Marino #define IXON	0x00400
1053468e90cSJohn Marino #define IXOFF	0x01000
1063468e90cSJohn Marino #define PARMRK	0x10000
1073468e90cSJohn Marino 
1083468e90cSJohn Marino /* oflag bits */
1093468e90cSJohn Marino #define OPOST	0x00001
1103468e90cSJohn Marino 
1113468e90cSJohn Marino /* cflag bits */
1123468e90cSJohn Marino #define CBAUD	 0x0100f
1133468e90cSJohn Marino #define B0	 0x00000
1143468e90cSJohn Marino #define B50	 0x00001
1153468e90cSJohn Marino #define B75	 0x00002
1163468e90cSJohn Marino #define B110	 0x00003
1173468e90cSJohn Marino #define B134	 0x00004
1183468e90cSJohn Marino #define B150	 0x00005
1193468e90cSJohn Marino #define B200	 0x00006
1203468e90cSJohn Marino #define B300	 0x00007
1213468e90cSJohn Marino #define B600	 0x00008
1223468e90cSJohn Marino #define B1200	 0x00009
1233468e90cSJohn Marino #define B1800	 0x0000a
1243468e90cSJohn Marino #define B2400	 0x0000b
1253468e90cSJohn Marino #define B4800	 0x0000c
1263468e90cSJohn Marino #define B9600	 0x0000d
1273468e90cSJohn Marino 
1283468e90cSJohn Marino #define CSIZE	 0x00030
1293468e90cSJohn Marino #define CS8	 0x00030
1303468e90cSJohn Marino #define CSTOPB	 0x00040
1313468e90cSJohn Marino #define CREAD	 0x00080
1323468e90cSJohn Marino #define PARENB	 0x00100
1333468e90cSJohn Marino #define PARODD	 0x00200
1343468e90cSJohn Marino #define HUPCL	 0x00400
1353468e90cSJohn Marino #define CLOCAL	 0x00800
1363468e90cSJohn Marino 
1373468e90cSJohn Marino #define TCIFLUSH	0
1383468e90cSJohn Marino #define TCSADRAIN	3
1393468e90cSJohn Marino 
1403468e90cSJohn Marino #ifndef cfgetospeed
1413468e90cSJohn Marino #define cfgetospeed(t) ((t)->c_cflag & CBAUD)
1423468e90cSJohn Marino #endif
1433468e90cSJohn Marino 
1443468e90cSJohn Marino #ifndef tcsetattr
1453468e90cSJohn Marino #define tcsetattr(fd, opt, arg) _nc_mingw_tcsetattr(fd, opt, arg)
1463468e90cSJohn Marino #endif
1473468e90cSJohn Marino 
1483468e90cSJohn Marino #ifndef tcgetattr
1493468e90cSJohn Marino #define tcgetattr(fd, arg) _nc_mingw_tcgetattr(fd, arg)
1503468e90cSJohn Marino #endif
1513468e90cSJohn Marino 
1523468e90cSJohn Marino #ifndef tcflush
1533468e90cSJohn Marino #define tcflush(fd, queue) _nc_mingw_tcflush(fd, queue)
1543468e90cSJohn Marino #endif
1553468e90cSJohn Marino 
1563468e90cSJohn Marino #undef  ttyname
1573468e90cSJohn Marino #define ttyname(fd) NULL
1583468e90cSJohn Marino 
159*32bb5217SDaniel Fojt #endif /* _WIN32 */
1603468e90cSJohn Marino #endif /* HAVE_TERMIO_H */
1613468e90cSJohn Marino 
1623468e90cSJohn Marino #endif /* HAVE_TERMIOS_H */
1633468e90cSJohn Marino 
1643468e90cSJohn Marino #endif /* NC_TERMIOS_included */
165