summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraaron <aaron@openbsd.org>1999-05-13 12:59:29 +0000
committeraaron <aaron@openbsd.org>1999-05-13 12:59:29 +0000
commit6957013ab02db9d7dd8e7010415a16f70513d95a (patch)
tree2054009d09d885344a57045cf0e013bf1c1e7325
parentcorrect a warning: don't test for format_char == 'x' twice in the same if() (diff)
downloadwireguard-openbsd-6957013ab02db9d7dd8e7010415a16f70513d95a.tar.xz
wireguard-openbsd-6957013ab02db9d7dd8e7010415a16f70513d95a.zip
create /var/msgs/bounds if it does not exist and reset it to its default
state so the (improved) man page does not lie; emory@hellyeah.com
-rw-r--r--usr.bin/msgs/msgs.1114
-rw-r--r--usr.bin/msgs/msgs.c18
2 files changed, 79 insertions, 53 deletions
diff --git a/usr.bin/msgs/msgs.1 b/usr.bin/msgs/msgs.1
index 1f75aee916d..77f4ef04b2b 100644
--- a/usr.bin/msgs/msgs.1
+++ b/usr.bin/msgs/msgs.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: msgs.1,v 1.4 1998/11/20 02:52:24 deraadt Exp $
+.\" $OpenBSD: msgs.1,v 1.5 1999/05/13 12:59:29 aaron Exp $
.\" $NetBSD: msgs.1,v 1.5 1995/09/28 06:57:39 tls Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
@@ -58,6 +58,55 @@ sent by mailing to the login `msgs' and should be short
pieces of information which are suitable to be read once by most users
of the system.
.Pp
+The options available are as follows:
+.Bl -tag -width Fl
+.It Fl f
+Do not say ``No new messages.''.
+This is useful in a
+.Pa .login
+file since this is often the case here.
+.It Fl q
+Queries whether there are messages, printing
+``There are new messages.'' if there are.
+The command ``msgs \-q'' is often used in login scripts.
+.It Fl h
+Print the first part of messages only.
+.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 l
+Causes only locally originated messages to be reported.
+.It Ar num
+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 Ar \-number
+Start
+.Ar number
+messages back from the one indicated in the
+.Pa \&.msgsrc
+file, useful for reviews of recent messages.
+.It Fl p
+Pipe long messages through the program specified by the
+.Ev PAGER
+environment variable. If
+.Ev PAGER
+is not defined,
+.Xr more 1
+is used.
+.El
+.Pp
.Nm msgs
is normally invoked each time you login, by placing it in the file
.Pa .login
@@ -99,11 +148,18 @@ mailbox and
.Xr mail 1
is invoked on that mailbox.
.It Ic p
-The specified message is piped through $PAGER, or, if $PAGER is not defined,
-.Xr more 1 .
-The commands `m', `p', and `s' all accept a numeric argument in place of the `\-'.
+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 `m', `p', and `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
@@ -150,48 +206,6 @@ to run every night. This will remove all messages over 21 days old.
A different expiration may be specified on the command line to override
the default.
.Pp
-Options when reading messages include:
-.Bl -tag -width Fl
-.It Fl f
-Do not to say ``No new messages.''.
-This is useful in a
-.Pa .login
-file since this is often the case here.
-.It Fl q
-Queries whether there are messages, printing
-``There are new messages.'' if there are.
-The command ``msgs \-q'' is often used in login scripts.
-.It Fl h
-Print the first part of messages only.
-.It Fl r
-Disables the ability to save messages or enter the mailer. It is
-assumed that $PAGER is set to something secure.
-.It Fl l
-Causes only locally originated messages to be reported.
-.It Ar num
-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 Ar \-number
-Start
-.Ar number
-messages back from the one indicated in the
-.Pa \&.msgsrc
-file, useful for reviews of recent messages.
-.It Fl p
-Pipe long messages through $PAGER, or, if $PAGER is not defined,
-.Xr more 1 .
-.El
-.Pp
Within
.Nm msgs
you can also go to any specific message by typing its number when
@@ -204,7 +218,9 @@ uses the
and
.Ev TERM
environment variables for the default home directory and
-terminal type.
+terminal type. If defined, the program specified by the
+.Ev PAGER
+variable is invoked as the pagination program.
.Sh FILES
.Bl -tag -width /var/msgs/* -compact
.It Pa /var/msgs/*
@@ -213,11 +229,11 @@ database
number of next message to be presented
.El
.Sh SEE ALSO
-.Xr aliases 5 ,
-.\".Xr crontab 5 ,
.Xr mail 1 ,
.Xr more 1 ,
+.Xr newaliases 1 ,
.Xr aliases 5
+.\".Xr crontab 5 ,
.Sh HISTORY
The
.Nm msgs
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c
index 1c3e0adb929..b09f03d4d20 100644
--- a/usr.bin/msgs/msgs.c
+++ b/usr.bin/msgs/msgs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msgs.c,v 1.12 1998/06/23 23:30:19 deraadt Exp $ */
+/* $OpenBSD: msgs.c,v 1.13 1999/05/13 12:59:29 aaron Exp $ */
/* $NetBSD: msgs.c,v 1.7 1995/09/28 06:57:40 tls Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)msgs.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: msgs.c,v 1.12 1998/06/23 23:30:19 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: msgs.c,v 1.13 1999/05/13 12:59:29 aaron Exp $";
#endif
#endif /* not lint */
@@ -256,8 +256,18 @@ main(argc, argv)
bounds = fopen(fname, "r");
if (bounds == NULL) {
- perror(fname);
- exit(1);
+ if (errno == ENOENT) {
+ if ((bounds = fopen(fname, "w+")) == NULL) {
+ perror(fname);
+ exit(1);
+ }
+ fprintf(bounds, "1 0\n");
+ rewind(bounds);
+ }
+ else {
+ perror(fname);
+ exit(1);
+ }
}
fscanf(bounds, "%d %d\n", &firstmsg, &lastmsg);