summaryrefslogtreecommitdiffstats
path: root/monop/monop.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1997-10-12 17:45:06 +0000
committerchristos <christos@NetBSD.org>1997-10-12 17:45:06 +0000
commita77b3f8edc13dc6efdbcf80e336689cfa1de08ab (patch)
treedfe6f38b6473068455b85cd2410d8394e1239336 /monop/monop.c
parent5526682d8116582745b79bee12e5007abfddcd86 (diff)
downloadbsdgames-darwin-a77b3f8edc13dc6efdbcf80e336689cfa1de08ab.tar.gz
bsdgames-darwin-a77b3f8edc13dc6efdbcf80e336689cfa1de08ab.tar.zst
bsdgames-darwin-a77b3f8edc13dc6efdbcf80e336689cfa1de08ab.zip
WARNSify
Diffstat (limited to 'monop/monop.c')
-rw-r--r--monop/monop.c67
1 files changed, 46 insertions, 21 deletions
diff --git a/monop/monop.c b/monop/monop.c
index 8e335226..4e77db29 100644
--- a/monop/monop.c
+++ b/monop/monop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: monop.c,v 1.3 1995/03/23 08:34:52 cgd Exp $ */
+/* $NetBSD: monop.c,v 1.4 1997/10/12 17:45:16 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -33,28 +33,39 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
+__COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)monop.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: monop.c,v 1.3 1995/03/23 08:34:52 cgd Exp $";
+__RCSID("$NetBSD: monop.c,v 1.4 1997/10/12 17:45:16 christos Exp $");
#endif
#endif /* not lint */
-# include "monop.def"
+#include <stdio.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "monop.def"
+
+int main __P((int, char *[]));
+static void getplayers __P((void));
+static void init_players __P((void));
+static void init_monops __P((void));
+static void do_quit __P((int));
/*
* This program implements a monopoly game
*/
+int
main(ac, av)
-reg int ac;
-reg char *av[]; {
+int ac;
+char *av[]; {
srand(getpid());
@@ -69,7 +80,7 @@ reg char *av[]; {
}
num_luck = sizeof lucky_mes / sizeof (char *);
init_decks();
- signal(2, quit);
+ signal(2, do_quit);
for (;;) {
printf("\n%s (%d) (cash $%d) on %s\n", cur_p->name, player + 1,
cur_p->money, board[cur_p->loc].name);
@@ -78,13 +89,23 @@ reg char *av[]; {
execute(getinp("-- Command: ", comlist));
}
}
+
+/*ARGSUSED*/
+static void
+do_quit(n)
+ int n;
+{
+ quit();
+}
/*
* This routine gets the names of the players
*/
-getplayers() {
+static void
+getplayers()
+{
- reg char *sp;
- reg int i, j;
+ char *sp;
+ int i, j;
char buf[257];
blew_it:
@@ -117,19 +138,21 @@ over:
else
printf("\"done\" is a reserved word. Please try again\n");
for (i = 0; i < num_play; i++)
- cfree(play[i].name);
- cfree(play);
+ free(play[i].name);
+ free(play);
goto blew_it;
}
}
/*
* This routine figures out who goes first
*/
-init_players() {
+static void
+init_players()
+{
- reg int i, rl, cur_max;
- bool over;
- int max_pl;
+ int i, rl, cur_max;
+ bool over = 0;
+ int max_pl = 0;
again:
putchar('\n');
@@ -155,10 +178,12 @@ again:
/*
* This routine initalizes the monopoly structures.
*/
-init_monops() {
+static void
+init_monops()
+{
- reg MON *mp;
- reg int i;
+ MON *mp;
+ int i;
for (mp = mon; mp < &mon[N_MON]; mp++) {
mp->name = mp->not_m;