-/* $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
* 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());
}
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);
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:
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');
/*
* 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;