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/adventure | |
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/adventure')
-rw-r--r-- | games/adventure/main.c | 4 | ||||
-rw-r--r-- | games/adventure/setup.c | 14 |
2 files changed, 13 insertions, 5 deletions
diff --git a/games/adventure/main.c b/games/adventure/main.c index 61c0bcd43ed..d589dd964c9 100644 --- a/games/adventure/main.c +++ b/games/adventure/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.21 2015/11/30 08:14:48 tb Exp $ */ +/* $OpenBSD: main.c,v 1.22 2016/01/07 16:00:31 tb Exp $ */ /* $NetBSD: main.c,v 1.5 1996/05/21 21:53:09 mrg Exp $ */ /*- @@ -71,7 +71,7 @@ main(int argc, char *argv[]) errx(1, "can't open file"); /* So give up */ case 2: /* Oops -- file was altered */ rspeak(202); /* You dissolve */ - exit(2); /* File could be non-adventure */ + return 2; /* File could be non-adventure */ } /* So don't unlink it. */ } diff --git a/games/adventure/setup.c b/games/adventure/setup.c index f062ac368fc..4bf438e76f4 100644 --- a/games/adventure/setup.c +++ b/games/adventure/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.12 2014/12/31 15:45:57 tedu Exp $ */ +/* $OpenBSD: setup.c,v 1.13 2016/01/07 16:00:31 tb Exp $ */ /* $NetBSD: setup.c,v 1.2 1995/03/21 12:05:10 cgd Exp $ */ /*- @@ -49,6 +49,7 @@ #include <err.h> #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #define USAGE "Usage: setup file > data.c (file is typically glorkz)\n" @@ -63,13 +64,20 @@ main(int argc, char *argv[]) FILE *infile; int c, count, linestart; + if (pledge("stdio rpath", NULL) == -1) + err(1, "pledge"); + if (argc != 2) { fprintf(stderr, USAGE); - exit(1); + return 1; } if ((infile = fopen(argv[1], "r")) == NULL) err(1, "Can't read file %s", argv[1]); + + if (pledge("stdio", NULL) == -1) + err(1, "pledge"); + puts("/*\n * data.c: created by setup from the ascii data file."); puts(SIG1); puts(SIG2); @@ -103,5 +111,5 @@ main(int argc, char *argv[]) } puts("\n\t0\n};"); fclose(infile); - exit(0); + return 0; } |