⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 library_16.html

📁 Glibc的中文手册
💻 HTML
📖 第 1 页 / 共 5 页
字号:
If this bit is not set and a modem disconnect is detected, a
<CODE>SIGHUP</CODE> signal is sent to the controlling process group for the
terminal (if it has one).  Normally, this causes the process to exit;
see section <A HREF="library_21.html#SEC330" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC330">Signal Handling</A>.  Reading from the terminal after a disconnect
causes an end-of-file condition, and writing causes an <CODE>EIO</CODE> error
to be returned.  The terminal device must be closed and reopened to
clear the condition.
<A NAME="IDX1123"></A>
<A NAME="IDX1124"></A>
<P>
<DT><CODE>HUPCL</CODE>
<DD>If this bit is set, a modem disconnect is generated when all processes
that have the terminal device open have either closed the file or exited.
<A NAME="IDX1125"></A>
<P>
<DT><CODE>CREAD</CODE>
<DD>If this bit is set, input can be read from the terminal.  Otherwise,
input is discarded when it arrives.
<A NAME="IDX1126"></A>
<P>
<DT><CODE>CSTOPB</CODE>
<DD>If this bit is set, two stop bits are used.  Otherwise, only one stop bit
is used.
<A NAME="IDX1127"></A>
<P>
<DT><CODE>PARENB</CODE>
<DD>If this bit is set, generation and detection of a parity bit are enabled.
See section <A HREF="library_16.html#SEC276" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC276">Input Modes</A>, for information on how input parity errors are handled.
<P>
If this bit is not set, no parity bit is added to output characters, and
input characters are not checked for correct parity.
<A NAME="IDX1128"></A>
<P>
<DT><CODE>PARODD</CODE>
<DD>This bit is only useful if <CODE>PARENB</CODE> is set.  If <CODE>PARODD</CODE> is set,
odd parity is used, otherwise even parity is used.
</DL>
<P>
The control mode flags also includes a field for the number of bits per
character.  You can use the <CODE>CSIZE</CODE> macro as a mask to extract the
value, like this: <CODE>settings.c_cflag &#38; CSIZE</CODE>.
<P>
<A NAME="IDX1129"></A>
<DL COMPACT>
<DT><CODE>CSIZE</CODE>
<DD>This is a mask for the number of bits per character.
<A NAME="IDX1130"></A>
<P>
<DT><CODE>CS5</CODE>
<DD>This specifies five bits per byte.
<A NAME="IDX1131"></A>
<P>
<DT><CODE>CS6</CODE>
<DD>This specifies six bits per byte.
<A NAME="IDX1132"></A>
<P>
<DT><CODE>CS7</CODE>
<DD>This specifies seven bits per byte.
<A NAME="IDX1133"></A>
<P>
<DT><CODE>CS8</CODE>
<DD>This specifies eight bits per byte.
<A NAME="IDX1134"></A>
<P>
<DT><CODE>CCTS_OFLOW</CODE>
<DD>If this bit is set, enable flow control of output based on the CTS wire
(RS232 protocol).
<A NAME="IDX1135"></A>
<P>
<DT><CODE>CRTS_IFLOW</CODE>
<DD>If this bit is set, enable flow control of input based on the RTS wire
(RS232 protocol).
<A NAME="IDX1136"></A>
<P>
<DT><CODE>MDMBUF</CODE>
<DD>If this bit is set, enable carrier-based flow control of output.
</DL>
<P>
<H3><A NAME="SEC279" HREF="library_toc.html#SEC279" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC279">Local Modes</A></H3>
<P>
This section describes the flags for the <CODE>c_lflag</CODE> member of the
<CODE>struct termios</CODE> structure.  These flags generally control
higher-level aspects of input processing than the input modes flags
described in section <A HREF="library_16.html#SEC276" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC276">Input Modes</A>, such as echoing, signals, and the choice
of canonical or noncanonical input.
<P>
The <CODE>c_lflag</CODE> member itself is an integer, and you change the flags
and fields using the operators <CODE>&#38;</CODE>, <CODE>|</CODE>, and <CODE>^</CODE>.  Don't
try to specify the entire value for <CODE>c_lflag</CODE>---instead, change
only specific flags and leave the rest untouched (see section <A HREF="library_16.html#SEC275" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC275">Setting Terminal Modes Properly</A>).
<P>
<A NAME="IDX1137"></A>
<DL COMPACT>
<DT><CODE>ICANON</CODE>
<DD>This bit, if set, enables canonical input processing mode.  Otherwise,
input is processed in noncanonical mode.  See section <A HREF="library_16.html#SEC271" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC271">Two Styles of Input: Canonical or Not</A>.
<A NAME="IDX1138"></A>
<P>
<DT><CODE>ECHO</CODE>
<DD>If this bit is set, echoing of input characters back to the terminal
is enabled.
<A NAME="IDX1139"></A>
<A NAME="IDX1140"></A>
<P>
<DT><CODE>ECHOE</CODE>
<DD>If this bit is set, echoing indicates erasure of input with the ERASE
character by erasing the last character in the current line from the
screen.  Otherwise, the character erased is re-echoed to show what has
happened (suitable for a printing terminal).
<P>
This bit only controls the display behavior; the <CODE>ICANON</CODE> bit by
itself controls actual recognition of the ERASE character and erasure of
input, without which <CODE>ECHOE</CODE> is simply irrelevant.
<A NAME="IDX1141"></A>
<P>
<DT><CODE>ECHOK</CODE>
<DD>This bit enables special display of the KILL character.  There are two
ways this can be done.  The better way is by erasing on the screen the
entire line that has been killed.  The worse way is by moving to a new
line after echoing the KILL character normally.  Some systems do one,
some systems do the other, and some let you choose either way.
<P>
If this bit is not set, the KILL character echoes just as it would if it
were not the KILL character.  Then it is up to the user to remember that
the KILL character has erased the preceding input; there is no
indication of this on the screen.
<P>
This bit only controls the display behavior; the <CODE>ICANON</CODE> bit by
itself controls actual recognition of the KILL character and erasure of
input, without which <CODE>ECHOK</CODE> is simply irrelevant.
<A NAME="IDX1142"></A>
<P>
<DT><CODE>ECHONL</CODE>
<DD>If this bit is set and the <CODE>ICANON</CODE> bit is also set, then the
newline (<CODE>'\n'</CODE>) character is echoed even if the <CODE>ECHO</CODE> bit
is not set.
<A NAME="IDX1143"></A>
<P>
<DT><CODE>ISIG</CODE>
<DD>This bit controls whether the INTR, QUIT, and SUSP characters are
recognized.  The functions associated with these characters are performed
if and only if this bit is set.  Being in canonical or noncanonical
input mode has no affect on the interpretation of these characters.
<P>
You should use caution when disabling recognition of these characters.
Programs that cannot be interrupted interactively are very
user-unfriendly.  If you clear this bit, your program should provide
some alternate interface that allows the user to interactively send the
signals associated with these characters, or to escape from the program.
<A NAME="IDX1144"></A>
<P>
See section <A HREF="library_16.html#SEC284" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC284">Characters that Cause Signals</A>.
<A NAME="IDX1145"></A>
<P>
<DT><CODE>IEXTEN</CODE>
<DD>This bit is similar to <CODE>ISIG</CODE>, but controls implementation-defined
special characters.  If it is set, it might override the default behavior
for the <CODE>ICANON</CODE> and <CODE>ISIG</CODE> local mode flags, and the <CODE>IXON</CODE>
and <CODE>IXOFF</CODE> input mode flags.
<A NAME="IDX1146"></A>
<P>
<DT><CODE>NOFLSH</CODE>
<DD>Normally, the INTR, QUIT, and SUSP characters cause input and output
queues for the terminal to be cleared.  If this bit is set, the queues
are not cleared.
<A NAME="IDX1147"></A>
<P>
<DT><CODE>TOSTOP</CODE>
<DD>If this bit is set and the system supports job control, then
<CODE>SIGTTOU</CODE> signals are generated by background processes that
attempt to write to the terminal.  See section <A HREF="library_24.html#SEC415" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_24.html#SEC415">Access to the Controlling Terminal</A>.
</DL>
<P>
The following bits are BSD extensions; the GNU library defines these
symbols on any system if you ask for them, but the settings of the bits
have no effect except on BSD systems.
<P>
<A NAME="IDX1148"></A>
<DL COMPACT>
<DT><CODE>ECHOKE</CODE>
<DD>On BSD systems, this bit selects between the two alternative ways of
displaying the KILL character, when <CODE>ECHOK</CODE> is set.  If
<CODE>ECHOKE</CODE> is set, then the KILL character erases the whole screen
line; otherwise, the KILL character moves to the next screen line.
The setting of <CODE>ECHOKE</CODE> has no effect when <CODE>ECHOK</CODE> is clear.
<P>
<A NAME="IDX1149"></A>
<DT><CODE>ECHOPRT</CODE>
<DD>This bit enables display of the ERASE character in a way that is geared
to a hardcopy terminal.
<A NAME="IDX1150"></A>
<P>
<DT><CODE>ECHOCTL</CODE>
<DD>If this bit is set, echo control characters with <SAMP>`^'</SAMP> followed by
the corresponding text character.  Thus, control-A echoes as <SAMP>`^A'</SAMP>.
<A NAME="IDX1151"></A>
<P>
<DT><CODE>ALTWERASE</CODE>
<DD>This bit determines how far the WERASE character should erase.  The
WERASE character erases back to the beginning of a word; the question
is, where do words begin?
<P>
If this bit is clear, then the beginning of a word is a nonwhitespace
character following a whitespace character.  If the bit is set, then the
beginning of a word is an alphanumeric character or underscore following
a character which is none of those.
<A NAME="IDX1152"></A>
<P>
<DT><CODE>FLUSHO</CODE>
<DD>This is the bit that toggles when the user types the DISCARD character.
While this bit is set, all output is discarded.  See section <A HREF="library_16.html#SEC286" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC286">Other Special Characters</A>.
<A NAME="IDX1153"></A>
<P>
<DT><CODE>NOKERNINFO</CODE>
<DD>Setting this bit disables handling of the STATUS character.
See section <A HREF="library_16.html#SEC286" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC286">Other Special Characters</A>.
<A NAME="IDX1154"></A>
<P>
<DT><CODE>PENDIN</CODE>
<DD>If this bit is set, it indicates that there is a line of input that
needs to be reprinted.  Typing the REPRINT character sets this bit; the
bit remains set until reprinting is finished.  See section <A HREF="library_16.html#SEC283" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC283">BSD Extensions to Editing Characters</A>.
</DL>
<P>
<A NAME="IDX1155"></A>
<A NAME="IDX1156"></A>
<A NAME="IDX1157"></A>
<A NAME="IDX1158"></A>
<H3><A NAME="SEC280" HREF="library_toc.html#SEC280" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC280">Line Speed</A></H3>
<P>
The terminal line speed tells the computer how fast to read and write
data on the terminal.
<P>
If the terminal is connected to a real serial line, the terminal speed
you specify actually controls the line--if it doesn't match the
terminal's own idea of the speed, communication does not work.  Real
serial ports accept only certain standard speeds.  Also, particular
hardware may not support even all the standard speeds.  Specifying a
speed of zero hangs up a dialup connection and turns off modem control
signals.
<P>
If the terminal is not a real serial line (for example, if it is a
network connection), then the line speed won't really affect data
transmission speed, but some programs will use it to determine the
amount of padding needed.  It's best to specify a line speed value that
matches the actual speed of the actual terminal, but you can safely
experiment with different values to vary the amount of padding.
<P>
There are actually two line speeds for each terminal, one for input and
one for output.  You can set them independently, but most often
terminals use the same speed for both directions.
<P>
The speed values are stored in the <CODE>struct termios</CODE> structure, but
don't try to access them in the <CODE>struct termios</CODE> structure
directly.  Instead, you should use the following functions to read and
store them:
<P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -