1WRITE(1P)                  POSIX Programmer's Manual                 WRITE(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       write - write to another user
13

SYNOPSIS

15       write user_name [terminal]
16

DESCRIPTION

18       The write utility shall read lines from the user's standard  input  and
19       write  them  to  the  terminal  of another user. When first invoked, it
20       shall write the message:
21
22
23              Message from sender-login-id (sending-terminal) [date]...
24
25       to user_name. When it has successfully completed  the  connection,  the
26       sender's  terminal  shall  be  alerted  twice to indicate that what the
27       sender is typing is being written to the recipient's terminal.
28
29       If the recipient wants to reply, this can be accomplished by typing:
30
31
32              write sender-login-id [sending-terminal]
33
34       upon receipt of the initial message. Whenever a line of input as delim‐
35       ited  by an NL, EOF, or EOL special character (see the Base Definitions
36       volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface)
37       is  accumulated  while  in  canonical  input mode, the accumulated data
38       shall be written on the other user's  terminal.   Characters  shall  be
39       processed as follows:
40
41        * Typing  <alert>  shall  write the alert character to the recipient's
42          terminal.
43
44        * Typing the erase and kill characters shall affect the sender's  ter‐
45          minal  in  the manner described by the termios interface in the Base
46          Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Ter‐
47          minal Interface.
48
49        * Typing  the interrupt or end-of-file characters shall cause write to
50          write an appropriate message ( "EOT\n" in the POSIX locale)  to  the
51          recipient's terminal and exit.
52
53        * Typing characters from LC_CTYPE classifications print or space shall
54          cause those characters to be sent to the recipient's terminal.
55
56        * When and only when the stty iexten local mode is enabled, the  exis‐
57          tence  and  processing  of additional special control characters and
58          multi-byte or single-byte functions is implementation-defined.
59
60        * Typing other non-printable characters  shall  cause  implementation-
61          defined  sequences  of  printable  characters  to  be written to the
62          recipient's terminal.
63
64       To write to a user who is logged in more than once, the terminal  argu‐
65       ment can be used to indicate which terminal to write to; otherwise, the
66       recipient's terminal is selected in  an  implementation-defined  manner
67       and  an  informational message is written to the sender's standard out‐
68       put, indicating which terminal was chosen.
69
70       Permission to be a recipient of  a  write  message  can  be  denied  or
71       granted  by  use  of  the mesg utility. However, a user's privilege may
72       further constrain the domain of accessibility of  other  users'  termi‐
73       nals.  The write utility shall fail when the user lacks the appropriate
74       privileges to perform the requested action.
75

OPTIONS

77       None.
78

OPERANDS

80       The following operands shall be supported:
81
82       user_name
83              Login name of the person to whom the message shall  be  written.
84              The  application  shall  ensure that this operand is of the form
85              returned by the who utility.
86
87       terminal
88              Terminal identification in the same format provided by  the  who
89              utility.
90
91

STDIN

93       Lines  to  be copied to the recipient's terminal are read from standard
94       input.
95

INPUT FILES

97       None.
98

ENVIRONMENT VARIABLES

100       The following environment  variables  shall  affect  the  execution  of
101       write:
102
103       LANG   Provide  a  default value for the internationalization variables
104              that are unset or null. (See  the  Base  Definitions  volume  of
105              IEEE Std 1003.1-2001,  Section  8.2,  Internationalization Vari‐
106              ables for the precedence of internationalization variables  used
107              to determine the values of locale categories.)
108
109       LC_ALL If  set  to a non-empty string value, override the values of all
110              the other internationalization variables.
111
112       LC_CTYPE
113              Determine the locale for  the  interpretation  of  sequences  of
114              bytes  of  text  data as characters (for example, single-byte as
115              opposed to multi-byte characters in arguments and input  files).
116              If the recipient's locale does not use an LC_CTYPE equivalent to
117              the sender's, the results are undefined.
118
119       LC_MESSAGES
120              Determine the locale that should be used to  affect  the  format
121              and  contents  of  diagnostic messages written to standard error
122              and informative messages written to standard output.
123
124       NLSPATH
125              Determine the location of message catalogs for the processing of
126              LC_MESSAGES .
127
128

ASYNCHRONOUS EVENTS

130       If  an  interrupt  signal is received, write shall write an appropriate
131       message on the recipient's terminal and exit with a status of zero.  It
132       shall take the standard action for all other signals.
133

STDOUT

135       An  informational  message  shall  be  written  to standard output if a
136       recipient is logged in more than once.
137

STDERR

139       The standard error shall be used only for diagnostic messages.
140

OUTPUT FILES

142       The recipient's terminal is used for output.
143

EXTENDED DESCRIPTION

145       None.
146

EXIT STATUS

148       The following exit values shall be returned:
149
150        0     Successful completion.
151
152       >0     The addressed user is not logged on or the addressed user denies
153              permission.
154
155

CONSEQUENCES OF ERRORS

157       Default.
158
159       The following sections are informative.
160

APPLICATION USAGE

162       The  talk utility is considered by some users to be a more usable util‐
163       ity on full-screen terminals.
164

EXAMPLES

166       None.
167

RATIONALE

169       The write utility was included in this volume  of  IEEE Std 1003.1-2001
170       since  it can be implemented on all terminal types. The standard devel‐
171       opers considered the talk utility, which cannot be implemented on  cer‐
172       tain  terminals,  to  be  a  "better" communications interface. Both of
173       these programs are in widespread  use  on  historical  implementations.
174       Therefore,  the  standard developers decided that both utilities should
175       be specified.
176
177       The format of the terminal name is unspecified, but the descriptions of
178       ps,  talk,  who, and write require that they all use or accept the same
179       format.
180

FUTURE DIRECTIONS

182       None.
183

SEE ALSO

185       mesg, talk, who, the Base Definitions volume  of  IEEE Std 1003.1-2001,
186       Chapter 11, General Terminal Interface
187
189       Portions  of  this text are reprinted and reproduced in electronic form
190       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
191       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
192       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
193       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
194       event of any discrepancy between this version and the original IEEE and
195       The  Open Group Standard, the original IEEE and The Open Group Standard
196       is the referee document. The original Standard can be  obtained  online
197       at http://www.opengroup.org/unix/online.html .
198
199
200
201IEEE/The Open Group                  2003                            WRITE(1P)
Impressum