Files
oldlinux-files/Ref-docs/POSIX/susv3/basedefs/termios.h.html
2024-02-19 00:21:47 -05:00

825 lines
16 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>&lt;termios.h&gt;</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="&lt;termios.h&gt;"></a> <a name="tag_13_74"></a><!-- &lt;termios.h&gt; -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_13_74_01"></a>NAME</h4>
<blockquote>termios.h - define values for termios</blockquote>
<h4><a name="tag_13_74_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><tt>#include &lt;termios.h&gt;</tt></p>
</blockquote>
<h4><a name="tag_13_74_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>&lt;termios.h&gt;</i> header contains the definitions used by the terminal I/O interfaces (see <a href=
"xbd_chap11.html#tag_11"><i>General Terminal Interface</i></a> for the structures and names defined).</p>
<h5><a name="tag_13_74_03_01"></a>The termios Structure</h5>
<p>The following data types shall be defined through <b>typedef</b>:</p>
<dl compact>
<dt><b>cc_t</b></dt>
<dd>Used for terminal special characters.</dd>
<dt><b>speed_t</b></dt>
<dd>Used for terminal baud rates.</dd>
<dt><b>tcflag_t</b></dt>
<dd>Used for terminal modes.</dd>
</dl>
<p>The above types shall be all unsigned integer types.</p>
<p>The implementation shall support one or more programming environments in which the widths of <b>cc_t</b>, <b>speed_t</b>, and
<b>tcflag_t</b> are no greater than the width of type <b>long</b>. The names of these programming environments can be obtained
using the <a href="../functions/confstr.html"><i>confstr</i>()</a> function or the <a href=
"../utilities/getconf.html"><i>getconf</i></a> utility.</p>
<p>The <b>termios</b> structure shall be defined, and shall include at least the following members:</p>
<pre>
<tt>tcflag_t c_iflag </tt> Input modes. <tt>
tcflag_t c_oflag </tt> Output modes. <tt>
tcflag_t c_cflag </tt> Control modes. <tt>
tcflag_t c_lflag </tt> Local modes. <tt>
cc_t c_cc[NCCS] </tt> Control characters. <tt>
</tt>
</pre>
<p>A definition shall be provided for:</p>
<dl compact>
<dt>NCCS</dt>
<dd>Size of the array <i>c_cc</i> for control characters.</dd>
</dl>
<p>The following subscript names for the array <i>c_cc</i> shall be defined:</p>
<center>
<table border="1" cellpadding="3" align="center">
<tr valign="top">
<th colspan="2" align="center">
<p class="tent"><b>Subscript Usage</b></p>
</th>
<th align="left">
<p class="tent">&nbsp;</p>
</th>
</tr>
<tr valign="top">
<th align="center">
<p class="tent"><b>Canonical Mode</b></p>
</th>
<th align="center">
<p class="tent"><b>Non-Canonical Mode</b></p>
</th>
<th align="center">
<p class="tent"><b>Description</b></p>
</th>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">VEOF</p>
</td>
<td align="left">
<p class="tent">&nbsp;</p>
</td>
<td align="left">
<p class="tent">EOF character.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">VEOL</p>
</td>
<td align="left">
<p class="tent">&nbsp;</p>
</td>
<td align="left">
<p class="tent">EOL character.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">VERASE</p>
</td>
<td align="left">
<p class="tent">&nbsp;</p>
</td>
<td align="left">
<p class="tent">ERASE character.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">VINTR</p>
</td>
<td align="left">
<p class="tent">VINTR</p>
</td>
<td align="left">
<p class="tent">INTR character.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">VKILL</p>
</td>
<td align="left">
<p class="tent">&nbsp;</p>
</td>
<td align="left">
<p class="tent">KILL character.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">&nbsp;</p>
</td>
<td align="left">
<p class="tent">VMIN</p>
</td>
<td align="left">
<p class="tent">MIN value.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">VQUIT</p>
</td>
<td align="left">
<p class="tent">VQUIT</p>
</td>
<td align="left">
<p class="tent">QUIT character.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">VSTART</p>
</td>
<td align="left">
<p class="tent">VSTART</p>
</td>
<td align="left">
<p class="tent">START character.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">VSTOP</p>
</td>
<td align="left">
<p class="tent">VSTOP</p>
</td>
<td align="left">
<p class="tent">STOP character.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">VSUSP</p>
</td>
<td align="left">
<p class="tent">VSUSP</p>
</td>
<td align="left">
<p class="tent">SUSP character.</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">&nbsp;</p>
</td>
<td align="left">
<p class="tent">VTIME</p>
</td>
<td align="left">
<p class="tent">TIME value.</p>
</td>
</tr>
</table>
</center>
<p>The subscript values shall be unique, except that the VMIN and VTIME subscripts may have the same values as the VEOF and VEOL
subscripts, respectively.</p>
<p>The following flags shall be provided.</p>
<h5><a name="tag_13_74_03_02"></a>Input Modes</h5>
<p>The <i>c_iflag</i> field describes the basic terminal input control:</p>
<dl compact>
<dt>BRKINT</dt>
<dd>Signal interrupt on break.</dd>
<dt>ICRNL</dt>
<dd>Map CR to NL on input.</dd>
<dt>IGNBRK</dt>
<dd>Ignore break condition.</dd>
<dt>IGNCR</dt>
<dd>Ignore CR.</dd>
<dt>IGNPAR</dt>
<dd>Ignore characters with parity errors.</dd>
<dt>INLCR</dt>
<dd>Map NL to CR on input.</dd>
<dt>INPCK</dt>
<dd>Enable input parity check.</dd>
<dt>ISTRIP</dt>
<dd>Strip character.</dd>
<dt>IXANY</dt>
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
Enable any character to restart output. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
<dt>IXOFF</dt>
<dd>Enable start/stop input control.</dd>
<dt>IXON</dt>
<dd>Enable start/stop output control.</dd>
<dt>PARMRK</dt>
<dd>Mark parity errors.</dd>
</dl>
<h5><a name="tag_13_74_03_03"></a>Output Modes</h5>
<p>The <i>c_oflag</i> field specifies the system treatment of output:</p>
<dl compact>
<dt>OPOST</dt>
<dd>Post-process output.</dd>
<dt>ONLCR</dt>
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
Map NL to CR-NL on output.</dd>
<dt>OCRNL</dt>
<dd>Map CR to NL on output.</dd>
<dt>ONOCR</dt>
<dd>No CR output at column 0.</dd>
<dt>ONLRET</dt>
<dd>NL performs CR function.</dd>
<dt>OFILL</dt>
<dd>Use fill characters for delay.</dd>
<dt>NLDLY</dt>
<dd>Select newline delays:
<dl compact>
<dt>NL0</dt>
<dd>Newline type 0.</dd>
<dt>NL1</dt>
<dd>Newline type 1.</dd>
</dl>
</dd>
<dt>CRDLY</dt>
<dd>Select carriage-return delays:
<dl compact>
<dt>CR0</dt>
<dd>Carriage-return delay type 0.</dd>
<dt>CR1</dt>
<dd>Carriage-return delay type 1.</dd>
<dt>CR2</dt>
<dd>Carriage-return delay type 2.</dd>
<dt>CR3</dt>
<dd>Carriage-return delay type 3.</dd>
</dl>
</dd>
<dt>TABDLY</dt>
<dd>Select horizontal-tab delays:
<dl compact>
<dt>TAB0</dt>
<dd>Horizontal-tab delay type 0.</dd>
<dt>TAB1</dt>
<dd>Horizontal-tab delay type 1.</dd>
<dt>TAB2</dt>
<dd>Horizontal-tab delay type 2.</dd>
<dt>TAB3</dt>
<dd>Expand tabs to spaces.</dd>
</dl>
</dd>
<dt>BSDLY</dt>
<dd>Select backspace delays:
<dl compact>
<dt>BS0</dt>
<dd>Backspace-delay type 0.</dd>
<dt>BS1</dt>
<dd>Backspace-delay type 1.</dd>
</dl>
</dd>
<dt>VTDLY</dt>
<dd>Select vertical-tab delays:
<dl compact>
<dt>VT0</dt>
<dd>Vertical-tab delay type 0.</dd>
<dt>VT1</dt>
<dd>Vertical-tab delay type 1.</dd>
</dl>
</dd>
<dt>FFDLY</dt>
<dd>Select form-feed delays:
<dl compact>
<dt>FF0</dt>
<dd>Form-feed delay type 0.</dd>
<dt>FF1</dt>
<dd>Form-feed delay type 1. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
</dl>
</dd>
</dl>
<h5><a name="tag_13_74_03_04"></a>Baud Rate Selection</h5>
<p>The input and output baud rates are stored in the <b>termios</b> structure. These are the valid values for objects of type
<b>speed_t</b>. The following values shall be defined, but not all baud rates need be supported by the underlying hardware.</p>
<dl compact>
<dt>B0</dt>
<dd>Hang up</dd>
<dt>B50</dt>
<dd>50 baud</dd>
<dt>B75</dt>
<dd>75 baud</dd>
<dt>B110</dt>
<dd>110 baud</dd>
<dt>B134</dt>
<dd>134.5 baud</dd>
<dt>B150</dt>
<dd>150 baud</dd>
<dt>B200</dt>
<dd>200 baud</dd>
<dt>B300</dt>
<dd>300 baud</dd>
<dt>B600</dt>
<dd>600 baud</dd>
<dt>B1200</dt>
<dd>1200 baud</dd>
<dt>B1800</dt>
<dd>1800 baud</dd>
<dt>B2400</dt>
<dd>2400 baud</dd>
<dt>B4800</dt>
<dd>4800 baud</dd>
<dt>B9600</dt>
<dd>9600 baud</dd>
<dt>B19200</dt>
<dd>19200 baud</dd>
<dt>B38400</dt>
<dd>38400 baud</dd>
</dl>
<h5><a name="tag_13_74_03_05"></a>Control Modes</h5>
<p>The <i>c_cflag</i> field describes the hardware control of the terminal; not all values specified are required to be supported
by the underlying hardware:</p>
<dl compact>
<dt>CSIZE</dt>
<dd>Character size:
<dl compact>
<dt>CS5</dt>
<dd>5 bits</dd>
<dt>CS6</dt>
<dd>6 bits</dd>
<dt>CS7</dt>
<dd>7 bits</dd>
<dt>CS8</dt>
<dd>8 bits</dd>
</dl>
</dd>
<dt>CSTOPB</dt>
<dd>Send two stop bits, else one.</dd>
<dt>CREAD</dt>
<dd>Enable receiver.</dd>
<dt>PARENB</dt>
<dd>Parity enable.</dd>
<dt>PARODD</dt>
<dd>Odd parity, else even.</dd>
<dt>HUPCL</dt>
<dd>Hang up on last close.</dd>
<dt>CLOCAL</dt>
<dd>Ignore modem status lines.</dd>
</dl>
<p>The implementation shall support the functionality associated with the symbols CS7, CS8, CSTOPB, PARODD, and PARENB.</p>
<h5><a name="tag_13_74_03_06"></a>Local Modes</h5>
<p>The <i>c_lflag</i> field of the argument structure is used to control various terminal functions:</p>
<dl compact>
<dt>ECHO</dt>
<dd>Enable echo.</dd>
<dt>ECHOE</dt>
<dd>Echo erase character as error-correcting backspace.</dd>
<dt>ECHOK</dt>
<dd>Echo KILL.</dd>
<dt>ECHONL</dt>
<dd>Echo NL.</dd>
<dt>ICANON</dt>
<dd>Canonical input (erase and kill processing).</dd>
<dt>IEXTEN</dt>
<dd>Enable extended input character processing.</dd>
<dt>ISIG</dt>
<dd>Enable signals.</dd>
<dt>NOFLSH</dt>
<dd>Disable flush after interrupt or quit.</dd>
<dt>TOSTOP</dt>
<dd>Send SIGTTOU for background output.</dd>
</dl>
<h5><a name="tag_13_74_03_07"></a>Attribute Selection</h5>
<p>The following symbolic constants for use with <a href="../functions/tcsetattr.html"><i>tcsetattr</i>()</a> are defined:</p>
<dl compact>
<dt>TCSANOW</dt>
<dd>Change attributes immediately.</dd>
<dt>TCSADRAIN</dt>
<dd>Change attributes when output has drained.</dd>
<dt>TCSAFLUSH</dt>
<dd>Change attributes when output has drained; also flush pending input.</dd>
</dl>
<h5><a name="tag_13_74_03_08"></a>Line Control</h5>
<p>The following symbolic constants for use with <a href="../functions/tcflush.html"><i>tcflush</i>()</a> shall be defined:</p>
<dl compact>
<dt>TCIFLUSH</dt>
<dd>Flush pending input.</dd>
<dt>TCIOFLUSH</dt>
<dd>Flush both pending input and untransmitted output.</dd>
<dt>TCOFLUSH</dt>
<dd>Flush untransmitted output.</dd>
</dl>
<p>The following symbolic constants for use with <a href="../functions/tcflow.html"><i>tcflow</i>()</a> shall be defined:</p>
<dl compact>
<dt>TCIOFF</dt>
<dd>Transmit a STOP character, intended to suspend input data.</dd>
<dt>TCION</dt>
<dd>Transmit a START character, intended to restart input data.</dd>
<dt>TCOOFF</dt>
<dd>Suspend output.</dd>
<dt>TCOON</dt>
<dd>Restart output.</dd>
</dl>
<p>The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.</p>
<pre>
<tt>speed_t cfgetispeed(const struct termios *);
speed_t cfgetospeed(const struct termios *);
int cfsetispeed(struct termios *, speed_t);
int cfsetospeed(struct termios *, speed_t);
int tcdrain(int);
int tcflow(int, int);
int tcflush(int, int);
int tcgetattr(int, struct termios *);
<sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0">
pid_t tcgetsid(int);
<img src="../images/opt-end.gif" alt="[Option End]" border="0">
int tcsendbreak(int, int);
int tcsetattr(int, int, const struct termios *);
</tt>
</pre>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_13_74_04"></a>APPLICATION USAGE</h4>
<blockquote>
<p>The following names are reserved for XSI-conformant systems to use as an extension to the above; therefore strictly conforming
applications shall not use them:</p>
<table cellpadding="3">
<tr valign="top">
<td align="left">
<p class="tent">CBAUD</p>
</td>
<td align="left">
<p class="tent">EXTB</p>
</td>
<td align="left">
<p class="tent">VDSUSP</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">DEFECHO</p>
</td>
<td align="left">
<p class="tent">FLUSHO</p>
</td>
<td align="left">
<p class="tent">VLNEXT</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">ECHOCTL</p>
</td>
<td align="left">
<p class="tent">LOBLK</p>
</td>
<td align="left">
<p class="tent">VREPRINT</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">ECHOK</p>
</td>
<td align="left">
<p class="tent">PENDIN</p>
</td>
<td align="left">
<p class="tent">VSTATUS</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">ECHOPRT</p>
</td>
<td align="left">
<p class="tent">SWTCH</p>
</td>
<td align="left">
<p class="tent">VWERASE</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">EXTA</p>
</td>
<td align="left">
<p class="tent">VDISCARD</p>
</td>
<td align="left">
<p class="tent">&nbsp;</p>
</td>
</tr>
</table>
</blockquote>
<h4><a name="tag_13_74_05"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_13_74_06"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_13_74_07"></a>SEE ALSO</h4>
<blockquote>
<p>The System Interfaces volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href=
"../functions/cfgetispeed.html"><i>cfgetispeed</i>()</a>, <a href="../functions/cfgetospeed.html"><i>cfgetospeed</i>()</a>, <a
href="../functions/cfsetispeed.html"><i>cfsetispeed</i>()</a>, <a href="../functions/cfsetospeed.html"><i>cfsetospeed</i>()</a>, <a
href="../functions/confstr.html"><i>confstr</i>()</a>, <a href="../functions/tcdrain.html"><i>tcdrain</i>()</a>, <a href=
"../functions/tcflow.html"><i>tcflow</i>()</a>, <a href="../functions/tcflush.html"><i>tcflush</i>()</a>, <a href=
"../functions/tcgetattr.html"><i>tcgetattr</i>()</a>, <a href="../functions/tcgetsid.html"><i>tcgetsid</i>()</a>, <a href=
"../functions/tcsendbreak.html"><i>tcsendbreak</i>()</a>, <a href="../functions/tcsetattr.html"><i>tcsetattr</i>()</a>, the Shell
and Utilities volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../utilities/getconf.html"><i>getconf</i></a>, <a href=
"xbd_chap11.html#tag_11"><i>General Terminal Interface</i></a></p>
</blockquote>
<h4><a name="tag_13_74_08"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 3.</p>
<p>Included for alignment with the ISO&nbsp;POSIX-1 standard.</p>
</blockquote>
<h4><a name="tag_13_74_09"></a>Issue 6</h4>
<blockquote>
<p>The LEGACY symbols IUCLC, OLCUC, and XCASE are removed.</p>
<p>FIPS 151-2 requirements for the symbols CS7, CS8, CSTOPB, PARODD, and PARENB are reaffirmed.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>