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/monop | |
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/monop')
-rw-r--r-- | games/monop/initdeck.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/games/monop/initdeck.c b/games/monop/initdeck.c index 210adfa7c7f..9118facfeb3 100644 --- a/games/monop/initdeck.c +++ b/games/monop/initdeck.c @@ -1,4 +1,4 @@ -/* $OpenBSD: initdeck.c,v 1.14 2015/08/22 14:47:41 deraadt Exp $ */ +/* $OpenBSD: initdeck.c,v 1.15 2016/01/07 16:00:32 tb Exp $ */ /* $NetBSD: initdeck.c,v 1.3 1995/03/23 08:34:43 cgd Exp $ */ /* @@ -34,6 +34,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> + #include "deck.h" /* @@ -70,6 +71,9 @@ main(ac, av) { int n; + if (pledge("stdio rpath wpath cpath", NULL) == -1) + err(1, "pledge"); + getargs(ac, av); if ((inf = fopen(infile, "r")) == NULL) err(1, "%s", infile); @@ -86,6 +90,9 @@ main(ac, av) if ((outf = fopen(outfile, "w")) == NULL) err(1, "%s", outfile); + if (pledge("stdio", NULL) == -1) + err(1, "pledge"); + fwrite(&deck[0].num_cards, sizeof(deck[0].num_cards), 1, outf); fwrite(&deck[0].top_card, sizeof(deck[0].top_card), 1, outf); fwrite(&deck[0].gojf_used, sizeof(deck[0].gojf_used), 1, outf); @@ -125,8 +132,9 @@ main(ac, av) } fclose(outf); - printf("There were %d com. chest and %d chance cards\n", CC_D.num_cards, CH_D.num_cards); - exit(0); + printf("There were %d com. chest and %d chance cards\n", CC_D.num_cards, + CH_D.num_cards); + return 0; } static void |