-/* $NetBSD: misc.c,v 1.21 2009/08/12 08:10:49 dholland Exp $ */
+/* $NetBSD: misc.c,v 1.23 2012/06/19 05:35:32 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: misc.c,v 1.21 2009/08/12 08:10:49 dholland Exp $");
+__RCSID("$NetBSD: misc.c,v 1.23 2012/06/19 05:35:32 dholland Exp $");
#endif
#endif /* not lint */
* "yes or "no" answer is gotten.
*/
int
-getyn(prompt)
- const char *prompt;
+getyn(const char *prompt)
{
int com;
* This routine tells the player if he's out of money.
*/
void
-notify()
+notify(void)
{
if (cur_p->money < 0)
printf("That leaves you $%d in debt\n", -cur_p->money);
* This routine switches to the next player
*/
void
-next_play()
+next_play(void)
{
player = (player + 1) % num_play;
cur_p = &play[player];
* given prompt.
*/
int
-get_int(prompt)
- const char *prompt;
+get_int(const char *prompt)
{
long num;
char *sp;
for (;;) {
printf("%s", prompt);
fgets(buf, sizeof(buf), stdin);
+ /* if stdin is closed we cant really play anymore */
if (feof(stdin))
- return 0;
+ quit();
sp = strchr(buf, '\n');
if (sp)
*sp = '\0';
* This routine sets the monopoly flag from the list given.
*/
void
-set_ownlist(pl)
- int pl;
+set_ownlist(int pl)
{
int num; /* general counter */
MON *orig; /* remember starting monop ptr */
* This routine sets things up as if it is a new monopoly
*/
static void
-is_monop(mp, pl)
- MON *mp;
- int pl;
+is_monop(MON *mp, int pl)
{
int i;
* This routine sets things up as if it is no longer a monopoly
*/
void
-is_not_monop(mp)
- MON *mp;
+is_not_monop(MON *mp)
{
int i;
* This routine gives a list of the current player's routine
*/
void
-list()
+list(void)
{
printhold(player);
}
* This routine gives a list of a given players holdings
*/
void
-list_all()
+list_all(void)
{
int pl;
* This routine gives the players a chance before it exits.
*/
void
-quit()
+quit(void)
{
putchar('\n');
+
+ /* We dont even have a chance to input y/n if stdin is closed */
+ if (feof(stdin))
+ exit(0);
+
if (getyn("Do you all really want to quit? ") == 0)
exit(0);
}