1MESG(1P)                   POSIX Programmer's Manual                  MESG(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       mesg - permit or deny messages
13

SYNOPSIS

15       mesg [y|n]
16

DESCRIPTION

18       The mesg utility shall control whether other users are allowed to  send
19       messages  via write, talk, or other utilities to a terminal device. The
20       terminal device affected shall be determined by searching for the first
21       terminal  in  the  sequence  of devices associated with standard input,
22       standard output, and standard error, respectively.  With no  arguments,
23       mesg shall report the current state without changing it. Processes with
24       appropriate privileges may be able to send  messages  to  the  terminal
25       independent of the current state.
26

OPTIONS

28       None.
29

OPERANDS

31       The following operands shall be supported in the POSIX locale:
32
33       y      Grant permission to other users to send messages to the terminal
34              device.
35
36       n      Deny permission to other users to send messages to the  terminal
37              device.
38
39

STDIN

41       Not used.
42

INPUT FILES

44       None.
45

ENVIRONMENT VARIABLES

47       The following environment variables shall affect the execution of mesg:
48
49       LANG   Provide  a  default value for the internationalization variables
50              that are unset or null. (See  the  Base  Definitions  volume  of
51              IEEE Std 1003.1-2001,  Section  8.2,  Internationalization Vari‐
52              ables for the precedence of internationalization variables  used
53              to determine the values of locale categories.)
54
55       LC_ALL If  set  to a non-empty string value, override the values of all
56              the other internationalization variables.
57
58       LC_CTYPE
59              Determine the locale for  the  interpretation  of  sequences  of
60              bytes  of  text  data as characters (for example, single-byte as
61              opposed to multi-byte characters in arguments).
62
63       LC_MESSAGES
64              Determine the locale that should be used to  affect  the  format
65              and  contents  of diagnostic messages written (by mesg) to stan‐
66              dard error.
67
68       NLSPATH
69              Determine the location of message catalogs for the processing of
70              LC_MESSAGES .
71
72

ASYNCHRONOUS EVENTS

74       Default.
75

STDOUT

77       If  no  operand  is  specified, mesg shall display the current terminal
78       state in an unspecified format.
79

STDERR

81       The standard error shall be used only for diagnostic messages.
82

OUTPUT FILES

84       None.
85

EXTENDED DESCRIPTION

87       None.
88

EXIT STATUS

90       The following exit values shall be returned:
91
92        0     Receiving messages is allowed.
93
94        1     Receiving messages is not allowed.
95
96       >1     An error occurred.
97
98

CONSEQUENCES OF ERRORS

100       Default.
101
102       The following sections are informative.
103

APPLICATION USAGE

105       The mechanism by which the message status of the terminal is changed is
106       unspecified. Therefore, unspecified actions may cause the status of the
107       terminal to change after mesg has successfully completed. These actions
108       may  include,  but  are  not limited to: another invocation of the mesg
109       utility, login procedures; invocation of the stty  utility,  invocation
110       of the chmod utility or chmod() function, and so on.
111

EXAMPLES

113       None.
114

RATIONALE

116       The  terminal  changed  by  mesg  is  that associated with the standard
117       input, output, or error, rather than the controlling terminal  for  the
118       session.  This is because users logged in more than once should be able
119       to change any of their login terminals without having to stop  the  job
120       running in those sessions. This is not a security problem involving the
121       terminals of  other  users  because  appropriate  privileges  would  be
122       required to affect the terminal of another user.
123
124       The  method  of  checking  each  of the first three file descriptors in
125       sequence until a terminal is found was adopted from System V.
126
127       The file /dev/tty is not specified for the terminal device  because  it
128       was  thought to be too restrictive. Typical environment changes for the
129       n operand are that write permissions are removed for others  and  group
130       from  the  appropriate  device.  It  was  decided  to  leave the actual
131       description of what is done as unspecified because of potential differ‐
132       ences between implementations.
133
134       The  format  for  standard output is unspecified because of differences
135       between historical implementations. This output is generally not useful
136       to  shell  scripts  (they can use the exit status), so exact parsing of
137       the output is unnecessary.
138

FUTURE DIRECTIONS

140       None.
141

SEE ALSO

143       talk, write()
144
146       Portions of this text are reprinted and reproduced in  electronic  form
147       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
148       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
149       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
150       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
151       event of any discrepancy between this version and the original IEEE and
152       The Open Group Standard, the original IEEE and The Open Group  Standard
153       is  the  referee document. The original Standard can be obtained online
154       at http://www.opengroup.org/unix/online.html .
155
156
157
158IEEE/The Open Group                  2003                             MESG(1P)
Impressum