This section describes the terminal attribute flags that control fairly low-level aspects of input processing: handling of parity errors, break signals, flow control, and <RET> and <LFD> characters.
All of these flags are bits in the
c_iflag member of the
struct termios structure. The member is an integer, and you
change flags using the operators
try to specify the entire value for
only specific flags and leave the rest untouched (see Setting Modes).
Parity checking on input processing is independent of whether parity detection and generation on the underlying terminal hardware is enabled; see Control Modes. For example, you could clear the
INPCKinput mode flag and set the
PARENBcontrol mode flag to ignore parity errors on input, but still generate parity on output.
If this bit is set, what happens when a parity error is detected depends on whether the
PARMRKbits are set. If neither of these bits are set, a byte with a parity error is passed to the application as a
If this bit is set, any byte with a framing or parity error is ignored. This is only useful if
INPCKis also set.
If this bit is set, input bytes with parity or framing errors are marked when passed to the program. This bit is meaningful only when
INPCKis set and
IGNPARis not set.
The way erroneous bytes are marked is with two preceding bytes,
0. Thus, the program actually reads three bytes for one erroneous byte received from the terminal.
If a valid byte has the value
ISTRIP(see below) is not set, the program might confuse it with the prefix that marks a parity error. So a valid byte
0377is passed to the program as two bytes,
0377, in this case.
If this bit is set, valid input bytes are stripped to seven bits; otherwise, all eight bits are available for programs to read.
If this bit is set, break conditions are ignored.
If this bit is set and
IGNBRKis not set, a break condition clears the terminal input and output queues and raises a
SIGINTsignal for the foreground process group associated with the terminal.
IGNBRKare set, a break condition is passed to the application as a single
PARMRKis not set, or otherwise as a three-character sequence
If this bit is set, carriage return characters (
'\r') are discarded on input. Discarding carriage return may be useful on terminals that send both carriage return and linefeed when you type the <RET> key.
If this bit is set and
IGNCRis not set, carriage return characters (
'\r') received as input are passed to the application as newline characters (
If this bit is set, newline characters (
'\n') received as input are passed to the application as carriage return characters (
If this bit is set, start/stop control on input is enabled. In other words, the computer sends STOP and START characters as necessary to prevent input from coming in faster than programs are reading it. The idea is that the actual terminal hardware that is generating the input data responds to a STOP character by suspending transmission, and to a START character by resuming transmission. See Start/Stop Characters.
If this bit is set, start/stop control on output is enabled. In other words, if the computer receives a STOP character, it suspends output until a START character is received. In this case, the STOP and START characters are never passed to the application program. If this bit is not set, then START and STOP can be read as ordinary characters. See Start/Stop Characters.
If this bit is set, any input character restarts output when output has been suspended with the STOP character. Otherwise, only the START character restarts output.
This is a BSD extension; it exists only on BSD systems and GNU/Linux and GNU/Hurd systems.