termios

Terminal control structure

Synopsis:

#include <termios.h>

struct termios {
    tcflag_t        c_iflag;
    tcflag_t        c_oflag;
    tcflag_t        c_cflag;
    tcflag_t        c_lflag;
    cc_t            c_cc[NCCS];
    uint32_t        reserved[3];
    speed_t         c_ispeed;
    speed_t         c_ospeed;
};

Description:

The termios control structure is defined in <termios.h>, and contains at least the members described below.

tcflag_t c_iflag
Input modes. This member contains at least the following bits:
BRKINT
Signal interrupt on break.
ICRNL
Map CR to NL on input.
IGNBRK
Ignore break conditions.
IGNCR
Ignore CR.
IGNPAR
Ignore characters with parity errors.
INLCR
Map NL to CR on input.
INPCK
Enable input parity check.
ISTRIP
Strip top bit from character.
IXOFF
Enable software input flow control (via START/STOP chars).
IXON
Enable software output flow control (via START/STOP chars).
PARMRK
Mark parity errors in the input data stream.
tcflag_t c_oflag
Output modes. This member contains at least the following bits:
OPOST
Perform output processing.
tcflag_t c_cflag
Control modes. This member contains at least the following bits:
CLOCAL
Ignore modem status lines.
CREAD
Enable receiver.
CSIZE
Number of data bits per character.
CS5
5 data bits.
CS6
6 data bits.
CS7
7 data bits.
CS8
8 data bits.
CSTOPB
Two stop bits, else one.
HUPCL
Hang up on last close.
IHFLOW
Support input flow control using the hardware handshaking lines.
OHFLOW
Support output flow control using the hardware handshaking lines.
PARENB
Parity enable.
PARODD
Odd parity, else even.
PARSTK
Stick parity (mark parity if PARODD is set, else space parity).
tcflag_t c_lflag
Local modes. This member contains at least the following bits:
ECHO
Enable echo.
ECHOE
Echo ERASE as destructive backspace.
ECHOK
Echo KILL as a line erase.
ECHONL
Echo \n, even if ECHO is off.
ICANON
Canonical input mode (line editing enabled).
IEXTEN
QNX Neutrino extensions to POSIX are enabled.
ISIG
Enable signals.
NOFLSH
Disable flush after interrupt, quit, or suspend.
TOSTOP
Send SIGTTOU for background output.
cc_t c_cc[NCCS]
Control characters. The array c_cc includes at least the following control characters:
c_cc[VEOF]
EOF character.
c_cc[VEOL]
EOL character.
c_cc[VERASE]
ERASE character.
c_cc[VFWD]
FORWARD character.
c_cc[VINTR]
INTR character.
c_cc[VKILL]
KILL character.
c_cc[VMIN]
MIN value.
c_cc[VQUIT]
QUIT character.
c_cc[VSUSP]
SUSP character.
c_cc[VTIME]
TIME value.
c_cc[VSTART]
START character.
c_cc[VSTOP]
STOP character.

The following control characters are also defined, but are only acted on if they're immediately preceded by the nonzero characters in c_cc[VPREFIX][4], and are immediately followed by the nonzero characters in c_cc[VSUFFIX][4] and the IEXTEN bit of c_lflag is set:

c_cc[VLEFT]
Left cursor motion.
c_cc[VRIGHT]
Right cursor motion.
c_cc[VUP]
Up cursor motion.
c_cc[VDOWN]
Down cursor motion.
c_cc[VINS]
Insert character.
c_cc[VDEL]
Delete character.
c_cc[VRUB]
Rubout character.
c_cc[VCAN]
Cancel character.
c_cc[VHOME]
Home character.
c_cc[VEND]
End character.

Any of the control characters in the c_cc array can be disabled by setting that character to the _PC_VDISABLE parameter that's returned by fpathconf() (typically a zero).

speed_t c_ispeed
Input baud rate. This member should be queried and set with the cfgetispeed() and cfsetispeed() functions.
speed_t c_ospeed
Output baud rate. This member should be queried and set with the cfgetospeed() and cfsetospeed() functions.

Classification:

POSIX 1003.1