From 17641e3181064a4b256bd1af9f64d90af0ac5a36 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 7 Jan 2016 16:00:31 +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/hack/hack.main.c | 4 ++-- games/hack/makedefs.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'games/hack') diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c index abf079b1a50..5d2ce344734 100644 --- a/games/hack/hack.main.c +++ b/games/hack/hack.main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.main.c,v 1.19 2015/12/16 14:21:50 tb Exp $ */ +/* $OpenBSD: hack.main.c,v 1.20 2016/01/07 16:00:32 tb Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -166,7 +166,7 @@ main(int argc, char **argv) chdirx(dir,0); #endif prscore(argc, argv); - exit(0); + return 0; } /* diff --git a/games/hack/makedefs.c b/games/hack/makedefs.c index af1c25a909f..1a80ab91448 100644 --- a/games/hack/makedefs.c +++ b/games/hack/makedefs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makedefs.c,v 1.8 2015/10/24 17:43:28 mmcc Exp $ */ +/* $OpenBSD: makedefs.c,v 1.9 2016/01/07 16:00:32 tb Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -62,10 +62,11 @@ */ #include +#include +#include #include #include #include -#include #include /* construct definitions of object constants */ @@ -88,13 +89,16 @@ main(int argc, char **argv) int propct = 0; char *sp; + if (pledge("stdio rpath", NULL) == -1) + err(1, "pledge"); + if (argc != 2) { (void)fprintf(stderr, "usage: makedefs file\n"); - exit(1); + return 1; } if ((fd = open(argv[1], O_RDONLY)) < 0) { perror(argv[1]); - exit(1); + return 1; } skipuntil("objects[] = {"); while(getentry()) { @@ -122,7 +126,7 @@ main(int argc, char **argv) printf("#define LAST_GEM (JADE+1)\n"); printf("#define LAST_RING %d\n", propct); printf("#define NROFOBJECTS %d\n", index-1); - exit(0); + return 0; } char line[LINSZ], *lp = line, *lp0 = line, *lpe = line; -- cgit v1.2.3-59-g8ed1b