1MESG(P) POSIX Programmer's Manual MESG(P)
2
3
4
6 mesg - permit or deny messages
7
9 mesg [y|n]
10
12 The mesg utility shall control whether other users are allowed to send
13 messages via write, talk, or other utilities to a terminal device. The
14 terminal device affected shall be determined by searching for the first
15 terminal in the sequence of devices associated with standard input,
16 standard output, and standard error, respectively. With no arguments,
17 mesg shall report the current state without changing it. Processes with
18 appropriate privileges may be able to send messages to the terminal
19 independent of the current state.
20
22 None.
23
25 The following operands shall be supported in the POSIX locale:
26
27 y Grant permission to other users to send messages to the terminal
28 device.
29
30 n Deny permission to other users to send messages to the terminal
31 device.
32
33
35 Not used.
36
38 None.
39
41 The following environment variables shall affect the execution of mesg:
42
43 LANG Provide a default value for the internationalization variables
44 that are unset or null. (See the Base Definitions volume of
45 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
46 ables for the precedence of internationalization variables used
47 to determine the values of locale categories.)
48
49 LC_ALL If set to a non-empty string value, override the values of all
50 the other internationalization variables.
51
52 LC_CTYPE
53 Determine the locale for the interpretation of sequences of
54 bytes of text data as characters (for example, single-byte as
55 opposed to multi-byte characters in arguments).
56
57 LC_MESSAGES
58 Determine the locale that should be used to affect the format
59 and contents of diagnostic messages written (by mesg) to stan‐
60 dard error.
61
62 NLSPATH
63 Determine the location of message catalogs for the processing of
64 LC_MESSAGES .
65
66
68 Default.
69
71 If no operand is specified, mesg shall display the current terminal
72 state in an unspecified format.
73
75 The standard error shall be used only for diagnostic messages.
76
78 None.
79
81 None.
82
84 The following exit values shall be returned:
85
86 0 Receiving messages is allowed.
87
88 1 Receiving messages is not allowed.
89
90 >1 An error occurred.
91
92
94 Default.
95
96 The following sections are informative.
97
99 The mechanism by which the message status of the terminal is changed is
100 unspecified. Therefore, unspecified actions may cause the status of the
101 terminal to change after mesg has successfully completed. These actions
102 may include, but are not limited to: another invocation of the mesg
103 utility, login procedures; invocation of the stty utility, invocation
104 of the chmod utility or chmod() function, and so on.
105
107 None.
108
110 The terminal changed by mesg is that associated with the standard
111 input, output, or error, rather than the controlling terminal for the
112 session. This is because users logged in more than once should be able
113 to change any of their login terminals without having to stop the job
114 running in those sessions. This is not a security problem involving the
115 terminals of other users because appropriate privileges would be
116 required to affect the terminal of another user.
117
118 The method of checking each of the first three file descriptors in
119 sequence until a terminal is found was adopted from System V.
120
121 The file /dev/tty is not specified for the terminal device because it
122 was thought to be too restrictive. Typical environment changes for the
123 n operand are that write permissions are removed for others and group
124 from the appropriate device. It was decided to leave the actual
125 description of what is done as unspecified because of potential differ‐
126 ences between implementations.
127
128 The format for standard output is unspecified because of differences
129 between historical implementations. This output is generally not useful
130 to shell scripts (they can use the exit status), so exact parsing of
131 the output is unnecessary.
132
134 None.
135
137 talk , write()
138
140 Portions of this text are reprinted and reproduced in electronic form
141 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
142 -- Portable Operating System Interface (POSIX), The Open Group Base
143 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
144 Electrical and Electronics Engineers, Inc and The Open Group. In the
145 event of any discrepancy between this version and the original IEEE and
146 The Open Group Standard, the original IEEE and The Open Group Standard
147 is the referee document. The original Standard can be obtained online
148 at http://www.opengroup.org/unix/online.html .
149
150
151
152IEEE/The Open Group 2003 MESG(P)