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 &
, |
and ^
. Don't try to specify the entire value for c_iflag
---instead, change 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 INPCK
input mode flag and set the PARENB
control 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 IGNPAR
or PARMRK
bits are set. If neither of these bits are set, a byte with a parity error is passed to the application as a '\0'
character.
INPCK
is also set.
INPCK
is set and IGNPAR
is not set.
The way erroneous bytes are marked is with two preceding bytes, 377
and 0
. Thus, the program actually reads three bytes for one erroneous byte received from the terminal.
If a valid byte has the value 0377
, and ISTRIP
(see below) is not set, the program might confuse it with the prefix that marks a parity error. So a valid byte 0377
is passed to the program as two bytes, 0377
0377
, in this case.
A break condition is defined in the context of asynchronous serial data transmission as a series of zero-value bits longer than a single byte.
IGNBRK
is not set, a break condition clears the terminal input and output queues and raises a SIGINT
signal for the foreground process group associated with the terminal.
If neither BRKINT
nor IGNBRK
are set, a break condition is passed to the application as a single '\0'
character if PARMRK
is not set, or otherwise as a three-character sequence '\377'
, '\0'
, '\0'
.
'\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.
IGNCR
is not set, carriage return characters ('\r'
) received as input are passed to the application as newline characters ('\n'
).
'\n'
) received as input are passed to the application as carriage return characters ('\r'
).
This is a BSD extension; it exists only on BSD systems and the GNU system.
007
) to the terminal to ring the bell. This is a BSD extension.