summaryrefslogtreecommitdiffstats
path: root/games/hack
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2016-01-07 16:00:31 +0000
committertb <tb@openbsd.org>2016-01-07 16:00:31 +0000
commit17641e3181064a4b256bd1af9f64d90af0ac5a36 (patch)
tree98fdab3423767c37a316f77c8d7dc5f03d43fc12 /games/hack
parentsync displayed interface flags to reality (diff)
downloadwireguard-openbsd-17641e3181064a4b256bd1af9f64d90af0ac5a36.tar.xz
wireguard-openbsd-17641e3181064a4b256bd1af9f64d90af0ac5a36.zip
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/hack')
-rw-r--r--games/hack/hack.main.c4
-rw-r--r--games/hack/makedefs.c14
2 files changed, 11 insertions, 7 deletions
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 <ctype.h>
+#include <err.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <fcntl.h>
#include <unistd.h>
/* 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;