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