diff options
author | tb <tb@cvs.openbsd.org> | 2016-01-07 16:00:35 +0000 |
---|---|---|
committer | tb <tb@cvs.openbsd.org> | 2016-01-07 16:00:35 +0000 |
commit | 93e376267b624e9b6d6dc70ec32418c59d2a25b0 (patch) | |
tree | 9b0fedba72c0c99cf7d268ba0c169cb908c27a59 /games/boggle/mkindex | |
parent | 58a106c10757a33412a67cbda574c32351dea1a8 (diff) |
Some basic code maintenance in games/
- in main() replace exit with return
- drop some /* NOTREACHED */ lint comments along the way.
- make more use of standard CFLAGS, esp. -Wimplicit-function-declaration
- add and sort some headers when needed
- add straightforward pledges to some programs used at compile time
discussed with and ok mestre@
Diffstat (limited to 'games/boggle/mkindex')
-rw-r--r-- | games/boggle/mkindex/Makefile | 3 | ||||
-rw-r--r-- | games/boggle/mkindex/mkindex.c | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/games/boggle/mkindex/Makefile b/games/boggle/mkindex/Makefile index 68eedb21581..3f7d9693917 100644 --- a/games/boggle/mkindex/Makefile +++ b/games/boggle/mkindex/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 1998/09/24 06:45:06 pjanzen Exp $ +# $OpenBSD: Makefile,v 1.4 2016/01/07 16:00:31 tb Exp $ # $NetBSD: Makefile,v 1.2 1995/03/21 12:14:51 cgd Exp $ # @(#)Makefile 8.1 (Berkeley) 6/11/93 @@ -9,4 +9,5 @@ CC=${HOSTCC} install: +.include "../../Makefile.inc" .include <bsd.prog.mk> diff --git a/games/boggle/mkindex/mkindex.c b/games/boggle/mkindex/mkindex.c index 82740d2149c..3ebf79d3419 100644 --- a/games/boggle/mkindex/mkindex.c +++ b/games/boggle/mkindex/mkindex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkindex.c,v 1.8 2009/10/27 23:59:24 deraadt Exp $ */ +/* $OpenBSD: mkindex.c,v 1.9 2016/01/07 16:00:31 tb Exp $ */ /* $NetBSD: mkindex.c,v 1.2 1995/03/21 12:14:52 cgd Exp $ */ /*- @@ -33,8 +33,10 @@ * SUCH DAMAGE. */ +#include <err.h> #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include "bog.h" @@ -47,6 +49,9 @@ main(int argc, char *argv[]) long off, start; char buf[MAXWORDLEN + 1]; + if (pledge("stdio", NULL) == -1) + err(1, "pledge"); + prev = '\0'; off = start = 0L; while (nextword(stdin, buf, &clen, &rlen) != NULL) { @@ -59,7 +64,7 @@ main(int argc, char *argv[]) off += clen + 1; } printf("%c %6ld %6ld\n", prev, start, off - 1); - exit(0); + return 0; } /* |