1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

Document that only superuser can use -c option. Add FBSDID. Make use of uid_t

to silent lint. fprintf -> err conversion. Add some FALLTHROUGH and NOTREACHED
comment to silent lint.
This commit is contained in:
Philippe Charnier 2002-04-12 13:11:42 +00:00
parent 4b952f84cb
commit 20c58ba5f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=94504
2 changed files with 19 additions and 13 deletions

View File

@ -81,7 +81,7 @@ and go on to the next message.
Redisplay the last message.
.It Fl q
Drop out of
.Nm ;
.Nm Ns ;
the next time
.Nm
will pick up where it last left off.
@ -156,7 +156,7 @@ option should be placed in
.Xr periodic 8 )
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.
the default. You must be the superuser to use this option.
.Pp
Options when reading messages include:
.Bl -tag -width Fl
@ -172,7 +172,7 @@ The command ``msgs \-q'' is often used in login scripts.
.It Fl h
Print the first part of messages only.
.It Fl l
Option causes only locally originated messages to be reported.
Cause only locally originated messages to be reported.
.It Ar num
A message number can be given
on the command line, causing

View File

@ -41,10 +41,11 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)msgs.c 8.2 (Berkeley) 4/28/95";
#endif
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* msgs - a user bulletin board program
*
@ -130,7 +131,7 @@ bool mailing = NO;
bool quitit = NO;
bool sending = NO;
bool intrpflg = NO;
int uid;
uid_t uid;
int msg;
int prevmsg;
int lct;
@ -201,10 +202,9 @@ int argc; char *argv[];
break;
case 'c':
if (uid != SUPERUSER && uid != DAEMON) {
fprintf(stderr, "Sorry\n");
exit(1);
}
if (uid != SUPERUSER && uid != DAEMON)
errx(1,
"only the super-user can use the c flag");
clean = YES;
break;
@ -540,26 +540,31 @@ int argc; char *argv[];
in = inbuf;
switch (*in) {
case 'x':
/* FALLTHROUGH */
case 'X':
exit(0);
/* NOTREACHED */
case 'q':
/* FALLTHROUGH */
case 'Q':
quitit = YES;
printf("--Postponed--\n");
exit(0);
/* intentional fall-thru */
/* NOTREACHED */
case 'n':
/* FALLTHROUGH */
case 'N':
if (msg >= nextmsg) sep = "Flushed";
prevmsg = msg;
break;
case 'p':
/* FALLTHROUGH */
case 'P':
use_pager = (*in++ == 'p');
/* intentional fallthru */
/* FALLTHROUGH */
case '\n':
/* FALLTHROUGH */
case 'y':
default:
if (*in == '-') {
@ -613,6 +618,7 @@ int argc; char *argv[];
if (!(already || hush || qopt))
printf("No new messages.\n");
exit(0);
/* NOTREACHED */
}
static void