|MESG(1)||General Commands Manual||MESG(1)|
NAME¶mesg - permit or deny messages
SYNOPSIS¶mesg [-s] [-v] [y|n|ye|ne|Y|N|NE] [d] [-p[w|t|k|a]] [-x[w|t|k|n]] [-m[l|c|a]] [-h[Y|y|n]] [-r[y|n]] [-b[y|n]]
DESCRIPTION¶This is the "Orville write" verison of the standard Unix mesg command.
Mesg with argument n forbids messages via write(1), ojot(1), tel(1), and talk(1) by revoking non-user write permission on the user's terminal. Mesg with argument y reinstates permission. All by itself, mesg reports the current state without changing it.
The ne and ye settings mean ``no with exceptions'' and ``yes with exceptions'' respectively. If ne is set, and there is file named .yeswrite in your home directory, then the users whose logins are listed there may still write you. If ye is set, and there is a file named .nowrite in your home directory, then the users whose logins are listed there may not write you. These files have no effect if the permissions are set to n or y. The .nowrite and .yeswrite files do not need to be permitted to anyone else, and almost any plausible format will be understood (listing one login name per line is a good default). Lines may be commented out with a # sign in the first column.
The upper case Y and N do all that the lower case ones do, but may have some additional affects depending on the installation.
The N argument, if enabled, will attempt to disconnect any write sessions currently directed at your tty. This is meant to allow users to slam the door on unwelcome writers. Note that a simple ``mesg n'' will not stop anyone who is already writing you from continuing to do so, it only prevents new connections from being made. The NE setting also causes a disconnect, but turns your settings to ne instead of n. The d argument causes a disconnect, just like ``mesg N'', but does not change your message permissions.
Normally mesg always depermits your tty device, so you can only be written through write and similar programs. This prevents arbitrary stuff from being redirected to your tty. When you do ``mesg Y'' your tty is write permitted to others. This is rarely necessary or desirable.
Mesg can also be used to set other switches that affect Orville write(1). The -p flag lets you set preferences to (w) write, (t) telegrams, (k) talk, or (a) any. The default is ``any.'' If you set a preference to write, then people will not be able to send telegrams or talk requests to you. If they try to send telegrams, they will be asked if they want to write you instead. Similarly if you prefer telegrams, people will not be able to write or talk to you, and if you prefer talk, people will not be able to write or tel you. You can designate two preferences, like ``mesg -pt -pw'' to allow people to write or telegram you, but not make talk requests to you. Alternately, you can use the -x flag to block particular programs. Doing ``mesg -xk'' blocks only the talk program, and is equivalent to ``mesg -pt -pw''. Similarly the ``-xn'' flag excludes no programs and is equivalent to ``-pa''. Trying to block all programs just turns you permissions off.
The -m flag lets you set modes to (l) line, (c) character, or (a) any. The default is ``any.'' If you set a mode, then all writes to you will be done in that mode. If you leave it as ``any,'' the choice is left to the writer. This will not affect connections already in progress, only future ones.
The -r flag lets you turn on or off the recording to telegrams sent to you. If it is enabled, everytime you are sent a telegram (or a write with input taken from a file), the text of the messages is saved in a file named .lastmesg in your home directory. This allows you to redisplay the last message sent to you using the huh(1) command. If a screen clear ate a telegram message before you had time to read it, then the huh command lets you see it again. Note that only the last message sent is stored. The file is permitted to be readable to you only.
The -b flag lets you tell the write and talk programs whether or not to beep when a person writes you or sends you a telegram. The default is to beep.
The -h flag lets you turn on or off your helper status. People who designate themselves as helpers are announcing their willingness to help out lost users. Their accounts will be marked on the output of the finger(1) command, and if anyone does a write or ojot(1) to ``help'' they automatically get connected to someone who has a help flag set. Normally, turning your permissions off also turns your helper-status off, but if you set the -h flag to Y, then you will remain a helper even when your message permissions are off. This means you can receive help requests, but not normal messages.
On some systems there is a restricted list of users who may be helpers. This is usually kept in the file /etc/helpers, one login name per line. If such a file exists then you will have to get the operators to add your name to it to be able to designate yourself as a helper.
If no new settings are given to mesg, then it just reports on the current settings. Normally it prints the message permissions, but if a -h, -p, -r, or -m flag was given without a new value after it, then the current status of that switch will be printed instead. If you use the -s flag, then this output will be suppressed. The command still reports the status of the selected switch with its numeric return code.
If you use the -v flag, all switch settings will be reported in a verbose mode.
The numeric values returned as return codes (see below) can also be used to set switches. Thus ``mesg 0 -m2'' sets permissions on, and the mode to any. This makes it easy for shell scripts to restore settings that were stored previously.
The argument syntax is actually a lot looser than mentioned above. The dashes before options may be omitted, Spaces may be added or omitted anywhere in the argument list.
SEE ALSO¶write(1), amin(1), finger(1), huh(1), helpers(1), talk(1)
DIAGNOSTICS¶Exit status is -1 on an error. Otherwise a code is returned reporting the status of one of the settings. If the arguments included -h, -p, or -m flags without a new value after it, then the last of these listed will be reported. Otherwise, if any options were set, the last of those listed in the argument list will be reported. And if nothing was set, then message permissions are reported.
When message permissions, record settings, or helper settings are reported, 0 indicates 'y', and 1 indicates 'n'. When preferences are reported, 1 indicates 'w', 2 indicates 't', and 4 indicates 'k', and any combinations are returned as sums of these values. When modes are reported, 0 indicates 'l', 1 indicates 'c', and 2 indicates 'a'.
BUGS¶Turning off 'talk' permissions will only work if you have a talkd which has been modified to understand Orville write's permission.
|January 20, 2000||7th Edition|