该宏定义了一组特殊字符,用于初始化termios结构中的cc数组.在termios手册页中,您可以看到它们的含义:
宏是八进制表示中的字符序列.https://en.wikipedia.org/wiki/Escape_sequences_in_C
在这里您可以找到八进制表示代码中的ascii:https://courses.engr.illinois.edu/ece390/books/labmanual/ascii-code-table.html
来自:http://man7.org/linux/man-pages/man3/termios.3.html
c_cc数组定义终端特殊字符.符号索引(初始值)和含义是:
VDISCARD
(not in POSIX; not supported under Linux; 017, SI, Ctrl-O)
Toggle: start/stop discarding pending output. Recognized when
IEXTEN is set, and then not passed as input.
VDSUSP (not in POSIX; not supported under Linux; 031, EM, Ctrl-Y)
Delayed suspend character (DSUSP): send SIGTSTP signal when
the character is read by the user program. Recognized when
IEXTEN and ISIG are set, and the system supports job control,
and then not passed as input.
VEOF (004, EOT, Ctrl-D) End-of-file character (EOF). More
precisely: this character causes the pending tty buffer to be
sent to the waiting user program without waiting for end-of-
line. If it is the first character of the line, the read(2)
in the user program returns 0, which signifies end-of-file.
Recognized when ICANON is set, and then not passed as input.
VEOL (0, NUL) Additional end-of-line character (EOL). Recognized
when ICANON is set.
VEOL2 (not in POSIX; 0, NUL) Yet another end-of-line character
(EOL2). Recognized when ICANON is set.
VERASE (0177, DEL, rubout, or 010, BS, Ctrl-H, or also #) Erase
character (ERASE). This erases the previous not-yet-erased
character, but does not erase past EOF or beginning-of-line.
Recognized when ICANON is set, and then not passed as input.
VINTR (003, ETX, Ctrl-C, or also 0177, DEL, rubout) Interrupt
character (INTR). Send a SIGINT signal. Recognized when ISIG
is set, and then not passed as input.
VKILL (025, NAK, Ctrl-U, or Ctrl-X, or also @) Kill character
(KILL). This erases the input since the last EOF or
beginning-of-line. Recognized when ICANON is set, and then
not passed as input.
VLNEXT (not in POSIX; 026, SYN, Ctrl-V) Literal next (LNEXT). Quotes
the next input character, depriving it of a possible special
meaning. Recognized when IEXTEN is set, and then not passed
as input.
VMIN Minimum number of characters for noncanonical read (MIN).
VQUIT (034, FS, Ctrl-\) Quit character (QUIT). Send SIGQUIT signal.
Recognized when ISIG is set, and then not passed as input.
VREPRINT
(not in POSIX; 022, DC2, Ctrl-R) Reprint unread characters
(REPRINT). Recognized when ICANON and IEXTEN are set, and
then not passed as input.
VSTART (021, DC1, Ctrl-Q) Start character (START). Restarts output
stopped by the Stop character. Recognized when IXON is set,
and then not passed as input.
VSTATUS
(not in POSIX; not supported under Linux; status request: 024,
DC4, Ctrl-T). Status character (STATUS). Display status
information at terminal, including state of foreground process
and amount of CPU time it has consumed. Also sends a SIGINFO
signal (not supported on Linux) to the foreground process
group.
VSTOP (023, DC3, Ctrl-S) Stop character (STOP). Stop output until
Start character typed. Recognized when IXON is set, and then
not passed as input.
VSUSP (032, SUB, Ctrl-Z) Suspend character (SUSP). Send SIGTSTP
signal. Recognized when ISIG is set, and then not passed as
input.
VSWTCH (not in POSIX; not supported under Linux; 0, NUL) Switch
character (SWTCH). Used in System V to switch shells in shell
layers, a predecessor to shell job control.
VTIME Timeout in deciseconds for noncanonical read (TIME).
VWERASE
(not in POSIX; 027, ETB, Ctrl-W) Word erase (WERASE).
Recognized when ICANON and IEXTEN are set, and then not passed
as input.
An individual terminal special character can be disabled by setting
the value of the corresponding c_cc element to _POSIX_VDISABLE.
The above symbolic subscript values are all different, except that
VTIME, VMIN may have the same value as VEOL, VEOF, respectively. In
noncanonical mode the special character meaning is replaced by the
timeout meaning. For an explanation of VMIN and VTIME, see the
description of noncanonical mode below.
Run Code Online (Sandbox Code Playgroud)