1WRITE(P) POSIX Programmer's Manual WRITE(P)
2
3
4
6 write - write to another user
7
9 write user_name [terminal]
10
12 The write utility shall read lines from the user's standard input and
13 write them to the terminal of another user. When first invoked, it
14 shall write the message:
15
16
17 Message from sender-login-id (sending-terminal) [date]...
18
19 to user_name. When it has successfully completed the connection, the
20 sender's terminal shall be alerted twice to indicate that what the
21 sender is typing is being written to the recipient's terminal.
22
23 If the recipient wants to reply, this can be accomplished by typing:
24
25
26 write sender-login-id [sending-terminal]
27
28 upon receipt of the initial message. Whenever a line of input as delim‐
29 ited by an NL, EOF, or EOL special character (see the Base Definitions
30 volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface)
31 is accumulated while in canonical input mode, the accumulated data
32 shall be written on the other user's terminal. Characters shall be
33 processed as follows:
34
35 * Typing <alert> shall write the alert character to the recipient's
36 terminal.
37
38 * Typing the erase and kill characters shall affect the sender's ter‐
39 minal in the manner described by the termios interface in the Base
40 Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Ter‐
41 minal Interface.
42
43 * Typing the interrupt or end-of-file characters shall cause write to
44 write an appropriate message ( "EOT\n" in the POSIX locale) to the
45 recipient's terminal and exit.
46
47 * Typing characters from LC_CTYPE classifications print or space shall
48 cause those characters to be sent to the recipient's terminal.
49
50 * When and only when the stty iexten local mode is enabled, the exis‐
51 tence and processing of additional special control characters and
52 multi-byte or single-byte functions is implementation-defined.
53
54 * Typing other non-printable characters shall cause implementation-
55 defined sequences of printable characters to be written to the
56 recipient's terminal.
57
58 To write to a user who is logged in more than once, the terminal argu‐
59 ment can be used to indicate which terminal to write to; otherwise, the
60 recipient's terminal is selected in an implementation-defined manner
61 and an informational message is written to the sender's standard out‐
62 put, indicating which terminal was chosen.
63
64 Permission to be a recipient of a write message can be denied or
65 granted by use of the mesg utility. However, a user's privilege may
66 further constrain the domain of accessibility of other users' termi‐
67 nals. The write utility shall fail when the user lacks the appropriate
68 privileges to perform the requested action.
69
71 None.
72
74 The following operands shall be supported:
75
76 user_name
77 Login name of the person to whom the message shall be written.
78 The application shall ensure that this operand is of the form
79 returned by the who utility.
80
81 terminal
82 Terminal identification in the same format provided by the who
83 utility.
84
85
87 Lines to be copied to the recipient's terminal are read from standard
88 input.
89
91 None.
92
94 The following environment variables shall affect the execution of
95 write:
96
97 LANG Provide a default value for the internationalization variables
98 that are unset or null. (See the Base Definitions volume of
99 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
100 ables for the precedence of internationalization variables used
101 to determine the values of locale categories.)
102
103 LC_ALL If set to a non-empty string value, override the values of all
104 the other internationalization variables.
105
106 LC_CTYPE
107 Determine the locale for the interpretation of sequences of
108 bytes of text data as characters (for example, single-byte as
109 opposed to multi-byte characters in arguments and input files).
110 If the recipient's locale does not use an LC_CTYPE equivalent to
111 the sender's, the results are undefined.
112
113 LC_MESSAGES
114 Determine the locale that should be used to affect the format
115 and contents of diagnostic messages written to standard error
116 and informative messages written to standard output.
117
118 NLSPATH
119 Determine the location of message catalogs for the processing of
120 LC_MESSAGES .
121
122
124 If an interrupt signal is received, write shall write an appropriate
125 message on the recipient's terminal and exit with a status of zero. It
126 shall take the standard action for all other signals.
127
129 An informational message shall be written to standard output if a
130 recipient is logged in more than once.
131
133 The standard error shall be used only for diagnostic messages.
134
136 The recipient's terminal is used for output.
137
139 None.
140
142 The following exit values shall be returned:
143
144 0 Successful completion.
145
146 >0 The addressed user is not logged on or the addressed user denies
147 permission.
148
149
151 Default.
152
153 The following sections are informative.
154
156 The talk utility is considered by some users to be a more usable util‐
157 ity on full-screen terminals.
158
160 None.
161
163 The write utility was included in this volume of IEEE Std 1003.1-2001
164 since it can be implemented on all terminal types. The standard devel‐
165 opers considered the talk utility, which cannot be implemented on cer‐
166 tain terminals, to be a "better" communications interface. Both of
167 these programs are in widespread use on historical implementations.
168 Therefore, the standard developers decided that both utilities should
169 be specified.
170
171 The format of the terminal name is unspecified, but the descriptions of
172 ps, talk, who, and write require that they all use or accept the same
173 format.
174
176 None.
177
179 mesg , talk , who , the Base Definitions volume of
180 IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface
181
183 Portions of this text are reprinted and reproduced in electronic form
184 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
185 -- Portable Operating System Interface (POSIX), The Open Group Base
186 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
187 Electrical and Electronics Engineers, Inc and The Open Group. In the
188 event of any discrepancy between this version and the original IEEE and
189 The Open Group Standard, the original IEEE and The Open Group Standard
190 is the referee document. The original Standard can be obtained online
191 at http://www.opengroup.org/unix/online.html .
192
193
194
195IEEE/The Open Group 2003 WRITE(P)