Table 18-1 in the http://www.cnblogs.com/nufangrensheng/p/3575752.html to Table 18-4All option flag (except the blocking flag) are represented by one or more bits (set or clear), while the blocking flag defines multiple bits and they are combined, therefore, multiple values can be defined. A blocking bit has a definition name, and each value also has a name.For example, to set the length of a character, first use the character length shield sign CSIZE to clear the characters that indicate the length of 0, and then set one of the following values: CS5, CS6, CS7, or CS8.
Instance: Use the shield flag to retrieve or set a value.
Program list 18-2 tcgetattr and tcsetattr instances
# Include "apue. h"
# Include <termios. h>
Int
Main (void)
{
Struct termios term;
If (tcgetattr (STDIN_FILENO, & term) <0)
Err_sys ("tcgetattr error ");
Switch (term. c_cflag & CSIZE)
{
Case CS5:
Printf ("5 bits/byte \ n ");
Break;
Case CS6:
Printf ("6 bits/byte \ n ");
Break;
Case CS7:
Printf ("7 bits/byte \ n ");
Break;
Case CS8:
Printf ("8 bits/byte \ n ");
Break;
Default:
Printf ("unknown bits/byte \ n ");
}
Term. c_cflag & = ~ CSIZE;/* zero out of the bits */
Term. c_cflag | = CS8;
If (tcsetattr (STDIN_FILENO, TCSANOW, & term) <0)
Err_sys ("tcsetattr error ");
Exit (0 );
}
For a detailed description of each option flag, refer to advanced programming in UNIX environment.