173f0a83dSXin LI /**************************************************************************** 2*aae38d10SBaptiste Daroussin * Copyright (c) 2011-2017,2018 Free Software Foundation, Inc. * 373f0a83dSXin LI * * 473f0a83dSXin LI * Permission is hereby granted, free of charge, to any person obtaining a * 573f0a83dSXin LI * copy of this software and associated documentation files (the * 673f0a83dSXin LI * "Software"), to deal in the Software without restriction, including * 773f0a83dSXin LI * without limitation the rights to use, copy, modify, merge, publish, * 873f0a83dSXin LI * distribute, distribute with modifications, sublicense, and/or sell * 973f0a83dSXin LI * copies of the Software, and to permit persons to whom the Software is * 1073f0a83dSXin LI * furnished to do so, subject to the following conditions: * 1173f0a83dSXin LI * * 1273f0a83dSXin LI * The above copyright notice and this permission notice shall be included * 1373f0a83dSXin LI * in all copies or substantial portions of the Software. * 1473f0a83dSXin LI * * 1573f0a83dSXin LI * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 1673f0a83dSXin LI * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 1773f0a83dSXin LI * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 1873f0a83dSXin LI * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 1973f0a83dSXin LI * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 2073f0a83dSXin LI * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 2173f0a83dSXin LI * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 2273f0a83dSXin LI * * 2373f0a83dSXin LI * Except as contained in this notice, the name(s) of the above copyright * 2473f0a83dSXin LI * holders shall not be used in advertising or otherwise to promote the * 2573f0a83dSXin LI * sale, use or other dealings in this Software without prior written * 2673f0a83dSXin LI * authorization. * 2773f0a83dSXin LI ****************************************************************************/ 2873f0a83dSXin LI 2973f0a83dSXin LI /**************************************************************************** 3073f0a83dSXin LI * Author: Thomas E. Dickey 2011 * 3173f0a83dSXin LI ****************************************************************************/ 3273f0a83dSXin LI 33*aae38d10SBaptiste Daroussin /* $Id: nc_termios.h,v 1.6 2018/06/24 00:06:37 tom Exp $ */ 3473f0a83dSXin LI 3573f0a83dSXin LI #ifndef NC_TERMIOS_included 3673f0a83dSXin LI #define NC_TERMIOS_included 1 3773f0a83dSXin LI 38*aae38d10SBaptiste Daroussin #include <ncurses_cfg.h> 39*aae38d10SBaptiste Daroussin 4073f0a83dSXin LI #if HAVE_TERMIOS_H && HAVE_TCGETATTR 4173f0a83dSXin LI 4273f0a83dSXin LI #else /* !HAVE_TERMIOS_H */ 4373f0a83dSXin LI 4473f0a83dSXin LI #if HAVE_TERMIO_H 4573f0a83dSXin LI 4673f0a83dSXin LI /* Add definitions to make termio look like termios. 4773f0a83dSXin LI * But ifdef it, since there are some implementations 4873f0a83dSXin LI * that try to do this for us in a fake <termio.h>. 4973f0a83dSXin LI */ 5073f0a83dSXin LI #ifndef TCSADRAIN 5173f0a83dSXin LI #define TCSADRAIN TCSETAW 5273f0a83dSXin LI #endif 5373f0a83dSXin LI #ifndef TCSAFLUSH 5473f0a83dSXin LI #define TCSAFLUSH TCSETAF 5573f0a83dSXin LI #endif 5673f0a83dSXin LI #ifndef tcsetattr 5773f0a83dSXin LI #define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg) 5873f0a83dSXin LI #endif 5973f0a83dSXin LI #ifndef tcgetattr 6073f0a83dSXin LI #define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg) 6173f0a83dSXin LI #endif 6273f0a83dSXin LI #ifndef cfgetospeed 6373f0a83dSXin LI #define cfgetospeed(t) ((t)->c_cflag & CBAUD) 6473f0a83dSXin LI #endif 6573f0a83dSXin LI #ifndef TCIFLUSH 6673f0a83dSXin LI #define TCIFLUSH 0 6773f0a83dSXin LI #endif 6873f0a83dSXin LI #ifndef tcflush 6973f0a83dSXin LI #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg) 7073f0a83dSXin LI #endif 7173f0a83dSXin LI 7273f0a83dSXin LI #else /* !HAVE_TERMIO_H */ 7373f0a83dSXin LI 74*aae38d10SBaptiste Daroussin #if _WIN32 7573f0a83dSXin LI 76*aae38d10SBaptiste Daroussin /* lflag bits */ 77*aae38d10SBaptiste Daroussin #define ISIG 0x0001 78*aae38d10SBaptiste Daroussin #define ICANON 0x0002 79*aae38d10SBaptiste Daroussin #define ECHO 0x0004 80*aae38d10SBaptiste Daroussin #define ECHOE 0x0008 81*aae38d10SBaptiste Daroussin #define ECHOK 0x0010 82*aae38d10SBaptiste Daroussin #define ECHONL 0x0020 83*aae38d10SBaptiste Daroussin #define NOFLSH 0x0040 84*aae38d10SBaptiste Daroussin #define IEXTEN 0x0100 85*aae38d10SBaptiste Daroussin 8673f0a83dSXin LI #define VEOF 4 87*aae38d10SBaptiste Daroussin #define VERASE 5 88*aae38d10SBaptiste Daroussin #define VINTR 6 89*aae38d10SBaptiste Daroussin #define VKILL 7 90*aae38d10SBaptiste Daroussin #define VMIN 9 91*aae38d10SBaptiste Daroussin #define VQUIT 10 92*aae38d10SBaptiste Daroussin #define VTIME 16 9373f0a83dSXin LI 94*aae38d10SBaptiste Daroussin /* iflag bits */ 95*aae38d10SBaptiste Daroussin #define IGNBRK 0x00001 96*aae38d10SBaptiste Daroussin #define BRKINT 0x00002 97*aae38d10SBaptiste Daroussin #define IGNPAR 0x00004 98*aae38d10SBaptiste Daroussin #define INPCK 0x00010 99*aae38d10SBaptiste Daroussin #define ISTRIP 0x00020 100*aae38d10SBaptiste Daroussin #define INLCR 0x00040 101*aae38d10SBaptiste Daroussin #define IGNCR 0x00080 102*aae38d10SBaptiste Daroussin #define ICRNL 0x00100 103*aae38d10SBaptiste Daroussin #define IXON 0x00400 104*aae38d10SBaptiste Daroussin #define IXOFF 0x01000 105*aae38d10SBaptiste Daroussin #define PARMRK 0x10000 10673f0a83dSXin LI 107*aae38d10SBaptiste Daroussin /* oflag bits */ 108*aae38d10SBaptiste Daroussin #define OPOST 0x00001 10973f0a83dSXin LI 110*aae38d10SBaptiste Daroussin /* cflag bits */ 111*aae38d10SBaptiste Daroussin #define CBAUD 0x0100f 112*aae38d10SBaptiste Daroussin #define B0 0x00000 113*aae38d10SBaptiste Daroussin #define B50 0x00001 114*aae38d10SBaptiste Daroussin #define B75 0x00002 115*aae38d10SBaptiste Daroussin #define B110 0x00003 116*aae38d10SBaptiste Daroussin #define B134 0x00004 117*aae38d10SBaptiste Daroussin #define B150 0x00005 118*aae38d10SBaptiste Daroussin #define B200 0x00006 119*aae38d10SBaptiste Daroussin #define B300 0x00007 120*aae38d10SBaptiste Daroussin #define B600 0x00008 121*aae38d10SBaptiste Daroussin #define B1200 0x00009 122*aae38d10SBaptiste Daroussin #define B1800 0x0000a 123*aae38d10SBaptiste Daroussin #define B2400 0x0000b 124*aae38d10SBaptiste Daroussin #define B4800 0x0000c 125*aae38d10SBaptiste Daroussin #define B9600 0x0000d 12673f0a83dSXin LI 127*aae38d10SBaptiste Daroussin #define CSIZE 0x00030 128*aae38d10SBaptiste Daroussin #define CS8 0x00030 129*aae38d10SBaptiste Daroussin #define CSTOPB 0x00040 130*aae38d10SBaptiste Daroussin #define CREAD 0x00080 131*aae38d10SBaptiste Daroussin #define PARENB 0x00100 132*aae38d10SBaptiste Daroussin #define PARODD 0x00200 133*aae38d10SBaptiste Daroussin #define HUPCL 0x00400 134*aae38d10SBaptiste Daroussin #define CLOCAL 0x00800 13573f0a83dSXin LI 13673f0a83dSXin LI #define TCIFLUSH 0 137*aae38d10SBaptiste Daroussin #define TCSADRAIN 3 13873f0a83dSXin LI 13973f0a83dSXin LI #ifndef cfgetospeed 14073f0a83dSXin LI #define cfgetospeed(t) ((t)->c_cflag & CBAUD) 14173f0a83dSXin LI #endif 14273f0a83dSXin LI 14373f0a83dSXin LI #ifndef tcsetattr 144*aae38d10SBaptiste Daroussin #define tcsetattr(fd, opt, arg) _nc_mingw_tcsetattr(fd, opt, arg) 14573f0a83dSXin LI #endif 14673f0a83dSXin LI 14773f0a83dSXin LI #ifndef tcgetattr 148*aae38d10SBaptiste Daroussin #define tcgetattr(fd, arg) _nc_mingw_tcgetattr(fd, arg) 14973f0a83dSXin LI #endif 15073f0a83dSXin LI 15173f0a83dSXin LI #ifndef tcflush 152*aae38d10SBaptiste Daroussin #define tcflush(fd, queue) _nc_mingw_tcflush(fd, queue) 15373f0a83dSXin LI #endif 15473f0a83dSXin LI 15573f0a83dSXin LI #undef ttyname 15673f0a83dSXin LI #define ttyname(fd) NULL 15773f0a83dSXin LI 158*aae38d10SBaptiste Daroussin #endif /* _WIN32 */ 15973f0a83dSXin LI #endif /* HAVE_TERMIO_H */ 16073f0a83dSXin LI 16173f0a83dSXin LI #endif /* HAVE_TERMIOS_H */ 16273f0a83dSXin LI 16373f0a83dSXin LI #endif /* NC_TERMIOS_included */ 164