summaryrefslogtreecommitdiff
path: root/usr.bin/msgs/msgs.1
blob: 7d5b8ff41c3a67c81afef37e60ddf54f803740f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
.\"	$OpenBSD: msgs.1,v 1.16 2007/03/15 22:39:52 jmc Exp $
.\"	$NetBSD: msgs.1,v 1.5 1995/09/28 06:57:39 tls Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"	@(#)msgs.1	8.2 (Berkeley) 4/28/95
.\"
.Dd April 28, 1995
.Dt MSGS 1
.Os
.Sh NAME
.Nm msgs
.Nd system messages and junk mail program
.Sh SYNOPSIS
.Nm msgs
.Op Fl fhlopqr
.Op Oo Fl Oc Ar number
.Nm msgs
.Op Fl s
.Nm msgs
.Op Fl c Op Fl Ns Ar days
.Sh DESCRIPTION
.Nm msgs
is used to read system messages.
These messages are
sent by mailing to the login
.Dq msgs
and should be short
pieces of information which are suitable to be read once by most users
of the system.
.Pp
The options are as follows:
.Bl -tag -width "-number"
.It Fl c Op Fl Ns Ar days
The
.Fl c
option is used for performing cleanup on
.Pa /var/msgs .
An entry with the
.Fl c
option should be placed in the system
.Xr crontab 5
to run every night.
This will remove all messages over 21 days old.
The optional
.Fl Ns Ar days
argument may be specified on the command line to override the default.
.It Fl f
Do not say
.Dq \&No new messages.
This is useful in a
.Pa .login
file since this is often the case here.
.It Fl h
Print the first part of messages only.
.It Fl l
Causes only locally originated messages to be reported.
.It Fl o
By default,
.Nm
exits when there are no more messages to read.
If the
.Fl o
flag is specified,
the user will be given the chance to save or read messages again.
.It Fl p
Pipe long messages through the program specified by the
.Ev PAGER
environment variable.
If
.Ev PAGER
is null or not defined,
.Xr more 1
is used.
.It Fl q
Queries whether there are messages, printing
.Dq There are new messages.
if there are.
The command
.Ic msgs -q
is often used in login scripts.
.It Fl r
Disables the ability to save messages or enter the mailer.
It is assumed that the
.Ev PAGER
environment is set to something secure.
.It Fl s
The
.Fl s
option is used for setting up the posting of messages.
The line
.Pp
.Dl msgs: \&"| /usr/bin/msgs -s\&"
.Pp
should be included in
.Pa /etc/mail/aliases
(see
.Xr newaliases 8 )
to enable posting of messages.
.It Ar number
A message number can be given
on the command line, causing
.Nm msgs
to start at the specified message rather than at the next message
indicated by your
.Pa .msgsrc
file.
Thus
.Pp
.Dl msgs -h 1
.Pp
prints the first part of all messages.
.It Fl Ns Ar number
Start
.Ar number
messages back from the one indicated in the
.Pa .msgsrc
file; useful for reviews of recent messages.
.El
.Pp
.Nm msgs
is normally invoked each time you login, by placing it in the file
.Pa .login
(or
.Pa .profile
if you use
.Xr sh 1 ) .
It will then prompt you with the source and subject of each new message.
If there is no subject line, the first few non-blank lines of the
message will be displayed.
If there is more to the message, you will be told how
long it is and asked whether you wish to see the rest of the message.
The possible responses are:
.Bl -tag -width Fl
.It Ic y
Type the rest of the message.
.It Ic RETURN
Synonym for
.Ic y .
.It Ic n
Skip this message
and go on to the next message.
.It Ic -
Redisplay the last message.
.It Ic q
Drop out of
.Nm msgs ;
the next time
.Nm msgs
will pick up where it last left off.
.It Ic s
Append the current message to the file
.Pa Messages
in the current directory;
.Sq s-
will save the previously displayed message.
An
.Sq s
or
.Sq s-
may be followed by a space and a file name to receive the message replacing
the default
.Dq Messages .
.It Ic m
A copy of the specified message is placed in a temporary
mailbox and
.Xr mail 1
is invoked on that mailbox.
.It Ic p
The specified message is piped through the program specified by the
.Ev PAGER
environment variable.
If
.Ev PAGER
is not defined,
.Xr more 1
is used.
.El
.Pp
The commands
.Ic m ,
.Ic p ,
and
.Ic s
all accept a numeric argument in place of the
.Sq - .
.Pp
.Nm msgs
keeps track of the next message you will see by a number in the file
.Pa .msgsrc
in your home directory.
In the directory
.Pa /var/msgs
it keeps a set of files whose names are the (sequential) numbers
of the messages they represent.
The file
.Pa /var/msgs/bounds
shows the low and high number of the messages in the directory
so that
.Nm msgs
can quickly determine if there are no messages for you.
.\" If the contents of
.\" .Pa bounds
.\" is incorrect it can be fixed by removing it;
.\" .Nm msgs
.\" will make a new
.\" .Pa bounds
.\" file the next time it is run.
.Pp
Within
.Nm msgs
you can also go to any specific message by typing its number when
.Nm msgs
requests input as to what to do.
.Sh ENVIRONMENT
.Nm msgs
uses the
.Ev HOME
and
.Ev TERM
environment variables for the default home directory and
terminal type.
If defined and non-null, the
.Ev PAGER
variable is invoked as the pagination program.
.Sh FILES
.Bl -tag -width /var/msgs/* -compact
.It Pa /var/msgs/*
database
.It ~/.msgsrc
number of next message to be presented
.El
.Sh SEE ALSO
.Xr mail 1 ,
.Xr more 1 ,
.Xr aliases 5 ,
.Xr crontab 5 ,
.Xr newaliases 8
.Sh HISTORY
The
.Nm msgs
command appeared in
.Bx 3.0 .