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