-/* $NetBSD: monop.c,v 1.6 1999/08/21 10:40:03 simonb Exp $ */
+/* $NetBSD: monop.c,v 1.13 2003/04/21 01:25:27 christos Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)monop.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: monop.c,v 1.6 1999/08/21 10:40:03 simonb Exp $");
+__RCSID("$NetBSD: monop.c,v 1.13 2003/04/21 01:25:27 christos Exp $");
#endif
#endif /* not lint */
static void init_players __P((void));
static void init_monops __P((void));
static void do_quit __P((int));
+void *heapstart;
/*
* This program implements a monopoly game
int ac;
char *av[];
{
+ /* Revoke setgid privileges */
+ setgid(getgid());
+
srand(getpid());
+ heapstart = sbrk(0);
if (ac > 1) {
if (!rest_f(av[1]))
restore();
/*ARGSUSED*/
static void
do_quit(n)
- int n;
+ int n __attribute__((__unused__));
{
quit();
}
break;
}
cur_p = play = (PLAY *) calloc(num_play, sizeof (PLAY));
+ if (play == NULL)
+ err(1, NULL);
for (i = 0; i < num_play; i++) {
over:
printf("Player %d's name: ", i + 1);
if (sp == buf)
goto over;
*sp++ = '\0';
- strcpy(name_list[i]=play[i].name=(char *)calloc(1,sp-buf),buf);
+ name_list[i] = play[i].name = (char *)calloc(1, sp - buf);
+ if (name_list[i] == NULL)
+ err(1, NULL);
+ strcpy(play[i].name, buf);
play[i].money = 1500;
}
name_list[i++] = "done";
}
/*
- * This routine initalizes the monopoly structures.
+ * This routine initializes the monopoly structures.
*/
static void
init_monops()