#ifndef __TERMIOS_H #define __TERMIOS_H /************************************************************************** ** ** - the definitions used by the terminal I/O interfaces ** *************************************************************************** ** Header introduced by the IEEE Std 1003.1-2017 *************************************************************************** ** *************************************************************************** ** * ** VMS SOFTWARE, INC. CONFIDENTIAL. This software is confidential * ** proprietary software licensed by VMS Software, Inc., and is not * ** authorized to be used, duplicated or disclosed to anyone without * ** the prior written permission of VMS Software, Inc. * ** Copyright 2021-2023 VMS Software, Inc. * ** * **************************************************************************/ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif /* ** The symbolic constants for use as subscripts for the array c_cc. */ #define VEOF 0 /* End-of-file character. */ #define VEOL 1 /* Additional end-of-line character. */ #define VERASE 3 /* Erase character (backspace). */ #define VKILL 5 /* Kill character. */ #define VINTR 8 /* Interrupt character. */ #define VQUIT 9 /* Quit character. */ #define VSUSP 10 /* Suspend character. */ #define VSTART 12 /* Start character. */ #define VSTOP 13 /* Stop character. */ #define VMIN 16 /* Minimum number of characters for noncanonical read. */ #define VTIME 17 /* Timeout in deciseconds for noncanonical read. */ #ifndef _POSIX_C_SOURCE #define VEOL2 2 /* Yet another end-of-line character. */ #define VWERASE 4 /* Word erase. */ #define VREPRINT 6 /* Reprint unread characters. */ #define VERASE2 7 /* The alternate erase character */ #define VDSUSP 11 /* Delayed suspend character. */ #define VLNEXT 14 /* Literal next. */ #define VDISCARD 15 /* Start/stop discarding pending output. */ #define VSTATUS 18 /* Status character. */ #endif #define NCCS 20 /* Size of the array c_cc for control characters. */ #define _POSIX_VDISABLE ((unsigned char)'\377') #ifndef _POSIX_C_SOURCE #define CCEQ(val, c) (c == val ? val != _POSIX_VDISABLE : 0) #endif /* ** Input flags */ #define IGNBRK 0x00000001 /* Ignore break condition. */ #define BRKINT 0x00000002 /* Signal interrupt on break. */ #define IGNPAR 0x00000004 /* Ignore characters with parity errors. */ #define PARMRK 0x00000008 /* Mark parity errors. */ #define INPCK 0x00000010 /* Enable input parity check. */ #define ISTRIP 0x00000020 /* Strip character. */ #define INLCR 0x00000040 /* Map NL to CR on input. */ #define IGNCR 0x00000080 /* Ignore CR. */ #define ICRNL 0x00000100 /* Map CR to NL on input. */ #define IXON 0x00000200 /* Enable start/stop output control. */ #define IXOFF 0x00000400 /* Enable start/stop input control. */ #ifndef _POSIX_C_SOURCE #define IXANY 0x00000800 /* Enable any character to restart output. */ #define IMAXBEL 0x00002000 /* Ring bell on input queue full. */ #define IUCLC 0x00004000 /* Map uppercase characters to lowercase on input. */ #endif /* ** Output flags */ #define OPOST 0x00000001 /* Post-process output. */ #if defined _XOPEN_SOURCE || !defined _POSIX_C_SOURCE #define ONLCR 0x00000002 /* Map NL to CR-NL on output. */ #define OXTABS 0x00000004 /* Expand tabs to spaces */ #define ONOEOT 0x00000008 /* Discard EOT's (^D) on output. */ #endif /*_XOPEN_SOURCE */ /* ** Standard speeds */ #define B0 0 #define B50 50 #define B75 75 #define B110 110 #define B134 134 #define B150 150 #define B200 200 #define B300 300 #define B600 600 #define B1200 1200 #define B1800 1800 #define B2400 2400 #define B4800 4800 #define B9600 9600 #define B19200 19200 #define B38400 38400 #ifndef _POSIX_C_SOURCE #define B7200 7200 #define B14400 14400 #define B28800 28800 #define B57600 57600 #define B76800 76800 #define B115200 115200 #define B230400 230400 #define B460800 460800 #define B921600 921600 #define EXTA 19200 #define EXTB 38400 #endif /* ** Control flags - hardware control of terminal */ #ifndef _POSIX_C_SOURCE #define CIGNORE 0x00000001 /* Ignore control flags. */ #endif #define CSIZE 0x00000300 /* Character size mask: */ #define CS5 0x00000000 /* 5 bits */ #define CS6 0x00000100 /* 6 bits */ #define CS7 0x00000200 /* 7 bits */ #define CS8 0x00000300 /* 8 bits */ #define CSTOPB 0x00000400 /* Send two stop bits, else one. */ #define CREAD 0x00000800 /* Enable receiver. */ #define PARENB 0x00001000 /* Parity enable. */ #define PARODD 0x00002000 /* Odd parity, else even. */ #define HUPCL 0x00004000 /* Hang up on last close. */ #define CLOCAL 0x00008000 /* Ignore modem status lines. */ #ifndef _POSIX_C_SOURCE #define CCTS_OFLOW 0x00010000 /* CTS flow control of output. */ #define CRTS_IFLOW 0x00020000 /* RTS flow control of input. */ #define CRTSCTS CCTS_OFLOW | CRTS_IFLOW /* Enable RTS/CTS (hardware) flow control. */ #define CDSR_OFLOW 0x00080000 /* DSR flow control of output. */ #define CDTR_IFLOW 0x00040000 /* DTR flow control of input. */ #define CCAR_OFLOW 0x00100000 /* Flow control output via Carrier. */ #define MDMBUF CCAR_OFLOW #endif /* ** Local flags */ #define ECHOE 0x00000002 /* Echo erase character as error-correcting backspace. */ #define ECHOK 0x00000004 /* Echo KILL. */ #define ECHO 0x00000008 /* Enable echo. */ #define ECHONL 0x00000010 /* Echo NL. */ #define ISIG 0x00000080 /* Enable signals. */ #define ICANON 0x00000100 /* Canonical input (erase and kill processing). */ #define IEXTEN 0x00000400 /* Enable extended input character processing. */ #define TOSTOP 0x00400000 /* Send SIGTTOU for background output. */ #define NOFLSH 0x80000000 /* Disable flush after interrupt or quit. */ #ifndef _POSIX_C_SOURCE #define ECHOKE 0x00000001 /* visual erase for line kill */ #define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */ #define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */ #define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */ #define EXTPROC 0x00000800 /* external processing */ #define FLUSHO 0x00800000 /* output being flushed (state) */ #define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */ #define PENDIN 0x20000000 /* XXX retype pending input (state) */ #endif /* ** Commands passed to tcsetattr() for setting the termios structure. */ #define TCSANOW 0 /* Change attributes immediately. */ #define TCSADRAIN 1 /* Change attributes when output has drained. */ #define TCSAFLUSH 2 /* Change attributes when output has drained; also flush pending input. */ /* ** Symbolic constants for use with tcflush(). */ #define TCIFLUSH 1 /* Flush pending input. */ #define TCOFLUSH 2 /* Flush untransmitted output. */ #define TCIOFLUSH 3 /* Flush both pending input and untransmitted output. */ /* ** Symbolic constants for use with tcflow(). */ #define TCOOFF 1 /* Suspend output. */ #define TCOON 2 /* Restart output. */ #define TCIOFF 3 /* Transmit a STOP character, intended to suspend input data. */ #define TCION 4 /* Transmit a START character, intended to restart input data. */ #if defined(__clang__) typedef unsigned int tcflag_t; /* Terminal modes. */ typedef int speed_t; /* Terminal baud rates. */ #else typedef unsigned long tcflag_t; /* Terminal modes. */ typedef long speed_t; /* Terminal baud rates. */ #endif typedef unsigned char cc_t; /* Terminal special characters. */ /* ** Save the users pointer context */ #if __INITIAL_POINTER_SIZE || defined(__clang__) # pragma __required_pointer_size __save # pragma __required_pointer_size 64 #endif struct termios { tcflag_t c_iflag; /* Input modes. */ tcflag_t c_oflag; /* Output modes. */ tcflag_t c_cflag; /* Control modes. */ tcflag_t c_lflag; /* Local modes. */ cc_t c_cc[NCCS]; /* Control characters. */ speed_t c_ispeed; /* Input speed. */ speed_t c_ospeed; /* Output speed. */ }; /* ** NOT IMPLEMENTED: */ /* speed_t cfgetispeed(const struct termios *); speed_t cfgetospeed(const struct termios *); int cfsetispeed(struct termios *, speed_t); int cfsetospeed(struct termios *, speed_t); int tcdrain(int); int tcflow(int, int); int tcflush(int, int); int tcgetattr(int, struct termios *); pid_t tcgetsid(int); int tcsendbreak(int, int); int tcsetattr(int, int, const struct termios *); */ /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE || defined(__clang__) # pragma __required_pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __standard #endif