diff options
author | charnier <charnier@FreeBSD.org> | 2002-04-12 13:11:42 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 2002-04-12 13:11:42 +0000 |
commit | d2aba719d3e2009b0557f8063286f3eafe16679e (patch) | |
tree | 8eee574b46a19737fe27602509e2403c9b7c2a18 /usr.bin/msgs/msgs.c | |
parent | eddee890415600dcbfacd7d1980e46a60cbc1979 (diff) | |
download | FreeBSD-src-d2aba719d3e2009b0557f8063286f3eafe16679e.zip FreeBSD-src-d2aba719d3e2009b0557f8063286f3eafe16679e.tar.gz |
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.
Diffstat (limited to 'usr.bin/msgs/msgs.c')
-rw-r--r-- | usr.bin/msgs/msgs.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c index eeda04f..5dee2b8 100644 --- a/usr.bin/msgs/msgs.c +++ b/usr.bin/msgs/msgs.c @@ -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 @@ cmnd: 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 @@ cmnd: if (!(already || hush || qopt)) printf("No new messages.\n"); exit(0); + /* NOTREACHED */ } static void |