#include <sys/termios.h>

sys/termios.h

139 macros · 12 functions · 3 typedefs · 1 struct

macroVEOF

Special Control Characters Index into c_cc[] character array. Name Subscript Enabled by
#define VEOF 0

macroVEOL

#define VEOL 1

macroVEOL2

#define VEOL2 2
ICANON together with IEXTEN

macroVERASE

#define VERASE 3

macroVWERASE

#define VWERASE 4
ICANON together with IEXTEN

macroVKILL

#define VKILL 5

macroVREPRINT

#define VREPRINT 6
ICANON together with IEXTEN

macroVINTR

7 spare 1
#define VINTR 8

macroVQUIT

#define VQUIT 9

macroVSUSP

#define VSUSP 10

macroVDSUSP

#define VDSUSP 11
ISIG together with IEXTEN

macroVSTART

#define VSTART 12

macroVSTOP

#define VSTOP 13

macroVLNEXT

#define VLNEXT 14

macroVDISCARD

#define VDISCARD 15

macroVMIN

#define VMIN 16

macroVTIME

#define VTIME 17

macroVSTATUS

#define VSTATUS 18
ICANON together with IEXTEN

macroNCCS

19 spare 2
#define NCCS 20

macroCCEQ

#define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0)

macroIGNBRK

Input flags - software input processing
#define IGNBRK 0x00000001
ignore BREAK condition

macroBRKINT

#define BRKINT 0x00000002
map BREAK to SIGINTR

macroIGNPAR

#define IGNPAR 0x00000004
ignore (discard) parity errors

macroPARMRK

#define PARMRK 0x00000008
mark parity and framing errors

macroINPCK

#define INPCK 0x00000010
enable checking of parity errors

macroISTRIP

#define ISTRIP 0x00000020
strip 8th bit off chars

macroINLCR

#define INLCR 0x00000040
map NL into CR

macroIGNCR

#define IGNCR 0x00000080
ignore CR

macroICRNL

#define ICRNL 0x00000100
map CR to NL (ala CRMOD)

macroIXON

#define IXON 0x00000200
enable output flow control

macroIXOFF

#define IXOFF 0x00000400
enable input flow control

macroIXANY

#define IXANY 0x00000800
any char will restart after stop

macroIMAXBEL

#define IMAXBEL 0x00002000
ring bell on input queue full

macroIUTF8

#define IUTF8 0x00004000
maintain state for UTF-8 VERASE

macroOPOST

Output flags - software output processing
#define OPOST 0x00000001
enable following output processing

macroONLCR

#define ONLCR 0x00000002
map NL to CR-NL (ala CRMOD)

macroOXTABS

#define OXTABS 0x00000004
expand tabs to spaces

macroONOEOT

#define ONOEOT 0x00000008
discard EOT's (^D) on output)

macroOCRNL

The following block of features is unimplemented. Use of these flags in programs will currently result in unexpected behaviour. - Begin unimplemented features
#define OCRNL 0x00000010
map CR to NL on output

macroONOCR

#define ONOCR 0x00000020
no CR output at column 0

macroONLRET

#define ONLRET 0x00000040
NL performs CR function

macroOFILL

#define OFILL 0x00000080
use fill characters for delay

macroNLDLY

#define NLDLY 0x00000300
\n delay

macroTABDLY

#define TABDLY 0x00000c04
horizontal tab delay

macroCRDLY

#define CRDLY 0x00003000
\r delay

macroFFDLY

#define FFDLY 0x00004000
form feed delay

macroBSDLY

#define BSDLY 0x00008000
\b delay

macroVTDLY

#define VTDLY 0x00010000
vertical tab delay

macroOFDEL

#define OFDEL 0x00020000
fill is DEL, else NUL

macroNL0

These manifest constants have the same names as those in the header <sys/ioctl_compat.h>, so you are not permitted to have both definitions in scope simultaneously in the same compilation unit. Nevertheless, they are required to be in scope when _POSIX_C_SOURCE is requested; this means that including the <sys/ioctl_compat.h> header before this one when _POSIX_C_SOURCE is in scope will result in redefintions. We attempt to maintain these as the same values so as to avoid this being an outright error in most compilers.
#define NL0 0x00000000

macroNL1

#define NL1 0x00000100

macroNL2

#define NL2 0x00000200

macroNL3

#define NL3 0x00000300

macroTAB0

#define TAB0 0x00000000

macroTAB1

#define TAB1 0x00000400

macroTAB2

#define TAB2 0x00000800

macroTAB3

not in sys/ioctl_compat.h, use OXTABS value
#define TAB3 0x00000004

macroCR0

#define CR0 0x00000000

macroCR1

#define CR1 0x00001000

macroCR2

#define CR2 0x00002000

macroCR3

#define CR3 0x00003000

macroFF0

#define FF0 0x00000000

macroFF1

#define FF1 0x00004000

macroBS0

#define BS0 0x00000000

macroBS1

#define BS1 0x00008000

macroVT0

#define VT0 0x00000000

macroVT1

#define VT1 0x00010000

macroCIGNORE

Control flags - hardware control of terminal
#define CIGNORE 0x00000001
ignore control flags

macroCSIZE

#define CSIZE 0x00000300
character size mask

macroCS5

#define CS5 0x00000000
5 bits (pseudo)

macroCS6

#define CS6 0x00000100
6 bits

macroCS7

#define CS7 0x00000200
7 bits

macroCS8

#define CS8 0x00000300
8 bits

macroCSTOPB

#define CSTOPB 0x00000400
send 2 stop bits

macroCREAD

#define CREAD 0x00000800
enable receiver

macroPARENB

#define PARENB 0x00001000
parity enable

macroPARODD

#define PARODD 0x00002000
odd parity, else even

macroHUPCL

#define HUPCL 0x00004000
hang up on last close

macroCLOCAL

#define CLOCAL 0x00008000
ignore modem status lines

macroCCTS_OFLOW

#define CCTS_OFLOW 0x00010000
CTS flow control of output

macroCRTSCTS

#define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW)

macroCRTS_IFLOW

#define CRTS_IFLOW 0x00020000
RTS flow control of input

macroCDTR_IFLOW

#define CDTR_IFLOW 0x00040000
DTR flow control of input

macroCDSR_OFLOW

#define CDSR_OFLOW 0x00080000
DSR flow control of output

macroCCAR_OFLOW

#define CCAR_OFLOW 0x00100000
DCD flow control of output

macroMDMBUF

#define MDMBUF 0x00100000
old name for CCAR_OFLOW

macroECHOKE

#define ECHOKE 0x00000001
visual erase for line kill

macroECHOE

#define ECHOE 0x00000002
visually erase chars

macroECHOK

#define ECHOK 0x00000004
echo NL after line kill

macroECHO

#define ECHO 0x00000008
enable echoing

macroECHONL

#define ECHONL 0x00000010
echo NL even if ECHO is off

macroECHOPRT

#define ECHOPRT 0x00000020
visual erase mode for hardcopy

macroECHOCTL

#define ECHOCTL 0x00000040
echo control chars as ^(Char)

macroISIG

#define ISIG 0x00000080
enable signals INTR, QUIT, [D]SUSP

macroICANON

#define ICANON 0x00000100
canonicalize input lines

macroALTWERASE

#define ALTWERASE 0x00000200
use alternate WERASE algorithm

macroIEXTEN

#define IEXTEN 0x00000400
enable DISCARD and LNEXT

macroEXTPROC

#define EXTPROC 0x00000800
external processing

macroTOSTOP

#define TOSTOP 0x00400000
stop background jobs from output

macroFLUSHO

#define FLUSHO 0x00800000
output being flushed (state)

macroNOKERNINFO

#define NOKERNINFO 0x02000000
no kernel output from VSTATUS

macroPENDIN

#define PENDIN 0x20000000
XXX retype pending input (state)

macroNOFLSH

#define NOFLSH 0x80000000
don't flush after interrupt

typedeftcflag_t

typedef unsigned long tcflag_t

typedefcc_t

typedef unsigned char cc_t

typedefspeed_t

typedef unsigned long speed_t

structtermios

size 72, align 8
tcflag_tc_iflaginput flags
tcflag_tc_oflagoutput flags
tcflag_tc_cflagcontrol flags
tcflag_tc_lflaglocal flags
cc_t[20]c_cccontrol chars
speed_tc_ispeedinput speed
speed_tc_ospeedoutput speed

macroTCSANOW

Commands passed to tcsetattr() for setting the termios structure.
#define TCSANOW 0
make change immediate

macroTCSADRAIN

#define TCSADRAIN 1
drain output, then change

macroTCSAFLUSH

#define TCSAFLUSH 2
drain output, flush input

macroTCSASOFT

#define TCSASOFT 0x10
flag - don't alter h.w. state

macroB0

Standard speeds
#define B0 0

macroB50

#define B50 50

macroB75

#define B75 75

macroB110

#define B110 110

macroB134

#define B134 134

macroB150

#define B150 150

macroB200

#define B200 200

macroB300

#define B300 300

macroB600

#define B600 600

macroB1200

#define B1200 1200

macroB1800

#define B1800 1800

macroB2400

#define B2400 2400

macroB4800

#define B4800 4800

macroB9600

#define B9600 9600

macroB19200

#define B19200 19200

macroB38400

#define B38400 38400

macroB7200

#define B7200 7200

macroB14400

#define B14400 14400

macroB28800

#define B28800 28800

macroB57600

#define B57600 57600

macroB76800

#define B76800 76800

macroB115200

#define B115200 115200

macroB230400

#define B230400 230400

macroEXTA

#define EXTA 19200

macroEXTB

#define EXTB 38400

macroTCIFLUSH

#define TCIFLUSH 1

macroTCOFLUSH

#define TCOFLUSH 2

macroTCIOFLUSH

#define TCIOFLUSH 3

macroTCOOFF

#define TCOOFF 1

macroTCOON

#define TCOON 2

macroTCIOFF

#define TCIOFF 3

macroTCION

#define TCION 4

functioncfgetispeed

speed_t cfgetispeed(const struct termios *)
man page · January 2, 1994
cfgetispeed(3) — manipulating the termios structure

functioncfgetospeed

speed_t cfgetospeed(const struct termios *)
man page · January 2, 1994
cfgetospeed(3) — manipulating the termios structure

functioncfsetispeed

int cfsetispeed(struct termios *, speed_t)
man page · January 2, 1994
cfsetispeed(3) — manipulating the termios structure

functioncfsetospeed

int cfsetospeed(struct termios *, speed_t)
man page · January 2, 1994
cfsetospeed(3) — manipulating the termios structure

functiontcgetattr

int tcgetattr(int, struct termios *)
man page · January 2, 1994
tcgetattr(3) — manipulating the termios structure

functiontcsetattr

int tcsetattr(int, int, const struct termios *)
man page · January 2, 1994
tcsetattr(3) — manipulating the termios structure

functiontcdrain

__DARWIN_ALIAS_C(tcdrain)
int tcdrain(int)
man page · June 4, 1993
tcdrain(3) — line control functions

functiontcflow

int tcflow(int, int)
man page · June 4, 1993
tcflow(3) — line control functions

functiontcflush

int tcflush(int, int)
man page · June 4, 1993
tcflush(3) — line control functions

functiontcsendbreak

int tcsendbreak(int, int)
man page · June 4, 1993
tcsendbreak(3) — line control functions

functioncfmakeraw

void cfmakeraw(struct termios *)
man page · January 2, 1994
cfmakeraw(3) — manipulating the termios structure

functioncfsetspeed

int cfsetspeed(struct termios *, speed_t)
man page · January 2, 1994
cfsetspeed(3) — manipulating the termios structure