Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ write(1) — SunOS 5.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mail(1)

mesg(1)

pr(1)

sh(1)

who(1)

setuid(2)

environ(5)

write(1)

NAME

write − write to another user

SYNOPSIS

write user [line]

AVAILABILITY

SUNWcsu

DESCRIPTION

write copies lines from your terminal to that of another user.  When first called, it sends the message:

Message from yourname (tty??) [ date ]...

to the person you want to talk to.  When it has successfully completed the connection, it also sends two bells to your own terminal to indicate that what you are typing is being sent. 

The recipient of the message should write back at this point.  Communication continues until an end of file is read from the terminal, an interrupt is sent, or the recipient has executed "mesg n".  At that point write writes EOT on the other terminal and exits. 

If you want to write to a user who is logged in more than once, the line argument may be used to indicate which line or terminal to send to (for example, term/12); otherwise, the first writable instance of the user found in /var/adm/utmp is assumed and the following message posted:

user is logged on more than one place.
You are connected to "terminal".
Other locations are:
terminal

Permission to write may be denied or granted by use of the mesg command.  Writing to others is normally allowed by default.  Certain commands, such as the pr command, disallow messages in order to prevent interference with their output.  However, if the user has super-user privilege, messages can be forced onto a write-inhibited terminal. 

If the character ! is found at the beginning of a line, write calls the shell to execute the rest of the line as a command. 

write runs setgid() [see setuid(2) ] to the group ID tty, in order to have write permissions on other user’s terminals. 

write will detect non-printable characters before sending them to the user’s terminal.  Control characters will appear as a ‘^’ followed by the appropriate ASCII character; characters with the high-order bit set will appear in “meta” notation.  For example, ‘\003’ is displayed as ‘^C’ and ‘\372’ as ‘M−z’. 

The following protocol is suggested for using write: when you first write to another user, wait for them to write back before starting to send.  Each person should end a message with a distinctive signal (that is, (o) for “over”) so that the other person knows when to reply.  The signal (oo) (for “over and out”) is suggested when conversation is to be terminated. 

ENVIRONMENT

If any of the LC_∗ variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY ) (see environ(5)) are not set in the environment, the operational behavior of write for each corresponding locale category is determined by the value of the LANG environment variable.  If LC_ALL is set, its contents are used to override both the LANG and the other LC_∗ variables.  If none of the above variables is set in the environment, the "C"  (U.S. style) locale determines how write behaves. 

LC_CTYPE
Determines how write handles characters. When LC_CTYPE is set to a valid value, write can display and handle text and filenames containing valid characters for that locale.  write can display and handle Extended Unix Code (EUC) characters where any individual character can be 1, 2, or 3 bytes wide.  write can also handle EUC characters of 1, 2, or more column widths. In the "C" locale, only characters from ISO 8859-1 are valid. 

LC_MESSAGES
Determines how diagnostic and informative messages are presented. This includes the language and style of the messages, and the correct form of affirmative and negative responses.  In the "C" locale, the messages are presented in the default form found in the program itself (in most cases, U.S. English).

LC_TIME
Determines how write handles date and time formats.  In the "C" locale, date and time handling follows the U.S.  rules. 

FILES

/var/adm/utmp to find user

/usr/bin/sh to execute !

SEE ALSO

mail(1), mesg(1), pr(1), sh(1), who(1), setuid(2), environ(5)

DIAGNOSTICS

user is not logged on The person you are trying to write to is not logged on. 

Permission denied The person you are trying to write to denies that permission (with mesg). 

Warning: cannot respond, set mesg -y
Your terminal is set to mesg n and the recipient cannot respond to you. 

Can no longer write to user
The recipient has denied permission (mesg n) after you had started writing. 

SunOS 5.2  —  Last change: 14 Sep 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026