Files
oldlinux-files/Ref-docs/POSIX/susv3/utilities/write.html
2024-02-19 00:21:47 -05:00

303 lines
11 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>write</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="write"></a> <a name="tag_04_172"></a><!-- write -->
<!--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_04_172_01"></a>NAME</h4>
<blockquote>write - write to another user</blockquote>
<h4><a name="tag_04_172_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<div class="box"><code><tt><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt=
"[Option Start]" border="0"> write</tt> <i>user_name</i> <b>[</b><i>terminal</i><b>]</b><tt><img src="../images/opt-end.gif" alt=
"[Option End]" border="0"></tt></code></div>
</blockquote>
<h4><a name="tag_04_172_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>write</i> utility shall read lines from the user's standard input and write them to the terminal of another user. When
first invoked, it shall write the message:</p>
<pre>
<b>Message from</b> <i>sender-login-id</i> <tt>(</tt><i>sending-terminal</i><tt>)</tt> <b>[</b><i>date</i><b>]</b><tt>...
</tt>
</pre>
<p>to <i>user_name</i>. When it has successfully completed the connection, the sender's terminal shall be alerted twice to indicate
that what the sender is typing is being written to the recipient's terminal.</p>
<p>If the recipient wants to reply, this can be accomplished by typing:</p>
<pre>
<tt>write</tt> <i>sender-login-id</i> <b>[</b><i>sending-terminal</i><b>]</b>
</pre>
<p>upon receipt of the initial message. Whenever a line of input as delimited by an NL, EOF, or EOL special character (see the Base
Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal
Interface</a>) is accumulated while in canonical input mode, the accumulated data shall be written on the other user's terminal.
Characters shall be processed as follows:</p>
<ul>
<li>
<p>Typing &lt;alert&gt; shall write the alert character to the recipient's terminal.</p>
</li>
<li>
<p>Typing the erase and kill characters shall affect the sender's terminal in the manner described by the <b>termios</b> interface
in the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General
Terminal Interface</a>.</p>
</li>
<li>
<p>Typing the interrupt or end-of-file characters shall cause <i>write</i> to write an appropriate message ( <tt>"EOT\n"</tt> in
the POSIX locale) to the recipient's terminal and exit.</p>
</li>
<li>
<p>Typing characters from <i>LC_CTYPE</i> classifications <b>print</b> or <b>space</b> shall cause those characters to be sent to
the recipient's terminal.</p>
</li>
<li>
<p>When and only when the <a href="../utilities/stty.html"><i>stty</i></a> <b>iexten</b> local mode is enabled, the existence and
processing of additional special control characters and multi-byte or single-byte functions is implementation-defined.</p>
</li>
<li>
<p>Typing other non-printable characters shall cause implementation-defined sequences of printable characters to be written to the
recipient's terminal.</p>
</li>
</ul>
<p>To write to a user who is logged in more than once, the <i>terminal</i> argument can be used to indicate which terminal to write
to; otherwise, the recipient's terminal is selected in an implementation-defined manner and an informational message is written to
the sender's standard output, indicating which terminal was chosen.</p>
<p>Permission to be a recipient of a <i>write</i> message can be denied or granted by use of the <a href=
"../utilities/mesg.html"><i>mesg</i></a> utility. However, a user's privilege may further constrain the domain of accessibility of
other users' terminals. The <i>write</i> utility shall fail when the user lacks the appropriate privileges to perform the requested
action.</p>
</blockquote>
<h4><a name="tag_04_172_04"></a>OPTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_172_05"></a>OPERANDS</h4>
<blockquote>
<p>The following operands shall be supported:</p>
<dl compact>
<dt><i>user_name</i></dt>
<dd>Login name of the person to whom the message shall be written. The application shall ensure that this operand is of the form
returned by the <a href="../utilities/who.html"><i>who</i></a> utility.</dd>
<dt><i>terminal</i></dt>
<dd>Terminal identification in the same format provided by the <a href="../utilities/who.html"><i>who</i></a> utility.</dd>
</dl>
</blockquote>
<h4><a name="tag_04_172_06"></a>STDIN</h4>
<blockquote>
<p>Lines to be copied to the recipient's terminal are read from standard input.</p>
</blockquote>
<h4><a name="tag_04_172_07"></a>INPUT FILES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_172_08"></a>ENVIRONMENT VARIABLES</h4>
<blockquote>
<p>The following environment variables shall affect the execution of <i>write</i>:</p>
<dl compact>
<dt><i>LANG</i></dt>
<dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of
IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> for
the precedence of internationalization variables used to determine the values of locale categories.)</dd>
<dt><i>LC_ALL</i></dt>
<dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
<dt><i>LC_CTYPE</i></dt>
<dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
opposed to multi-byte characters in arguments and input files). If the recipient's locale does not use an <i>LC_CTYPE</i>
equivalent to the sender's, the results are undefined.</dd>
<dt><i>LC_MESSAGES</i></dt>
<dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and
informative messages written to standard output.</dd>
<dt><i>NLSPATH</i></dt>
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt=
"[Option End]" border="0"></dd>
</dl>
</blockquote>
<h4><a name="tag_04_172_09"></a>ASYNCHRONOUS EVENTS</h4>
<blockquote>
<p>If an interrupt signal is received, <i>write</i> shall write an appropriate message on the recipient's terminal and exit with a
status of zero. It shall take the standard action for all other signals.</p>
</blockquote>
<h4><a name="tag_04_172_10"></a>STDOUT</h4>
<blockquote>
<p>An informational message shall be written to standard output if a recipient is logged in more than once.</p>
</blockquote>
<h4><a name="tag_04_172_11"></a>STDERR</h4>
<blockquote>
<p>The standard error shall be used only for diagnostic messages.</p>
</blockquote>
<h4><a name="tag_04_172_12"></a>OUTPUT FILES</h4>
<blockquote>
<p>The recipient's terminal is used for output.</p>
</blockquote>
<h4><a name="tag_04_172_13"></a>EXTENDED DESCRIPTION</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_172_14"></a>EXIT STATUS</h4>
<blockquote>
<p>The following exit values shall be returned:</p>
<dl compact>
<dt>&nbsp;0</dt>
<dd>Successful completion.</dd>
<dt>&gt;0</dt>
<dd>The addressed user is not logged on or the addressed user denies permission.</dd>
</dl>
</blockquote>
<h4><a name="tag_04_172_15"></a>CONSEQUENCES OF ERRORS</h4>
<blockquote>
<p>Default.</p>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_04_172_16"></a>APPLICATION USAGE</h4>
<blockquote>
<p>The <a href="../utilities/talk.html"><i>talk</i></a> utility is considered by some users to be a more usable utility on
full-screen terminals.</p>
</blockquote>
<h4><a name="tag_04_172_17"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_172_18"></a>RATIONALE</h4>
<blockquote>
<p>The <i>write</i> utility was included in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 since it can be implemented on all
terminal types. The standard developers considered the <a href="../utilities/talk.html"><i>talk</i></a> utility, which cannot be
implemented on certain terminals, to be a &quot;better&quot; communications interface. Both of these programs are in widespread use on
historical implementations. Therefore, the standard developers decided that both utilities should be specified.</p>
<p>The format of the terminal name is unspecified, but the descriptions of <a href="../utilities/ps.html"><i>ps</i></a>, <a href=
"../utilities/talk.html"><i>talk</i></a>, <a href="../utilities/who.html"><i>who</i></a>, and <i>write</i> require that they all
use or accept the same format.</p>
</blockquote>
<h4><a name="tag_04_172_19"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_172_20"></a>SEE ALSO</h4>
<blockquote>
<p><a href="mesg.html"><i>mesg</i></a> , <a href="talk.html"><i>talk</i></a> , <a href="who.html"><i>who</i></a> , the Base
Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal
Interface</a></p>
</blockquote>
<h4><a name="tag_04_172_21"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 2.</p>
</blockquote>
<h4><a name="tag_04_172_22"></a>Issue 5</h4>
<blockquote>
<p>The FUTURE DIRECTIONS section is added.</p>
</blockquote>
<h4><a name="tag_04_172_23"></a>Issue 6</h4>
<blockquote>
<p>This utility is marked as part of the User Portability Utilities option.</p>
<p>The normative text is reworded to avoid use of the term &quot;must&quot; for application requirements.</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>