From 93e376267b624e9b6d6dc70ec32418c59d2a25b0 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 7 Jan 2016 16:00:35 +0000 Subject: 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@ --- games/boggle/mkindex/Makefile | 3 ++- games/boggle/mkindex/mkindex.c | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'games/boggle/mkindex') 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 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 #include #include +#include #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; } /* -- cgit v1.2.3