CVS commit: src/games/monop

2014-12-29 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon Dec 29 10:27:03 UTC 2014

Modified Files:
src/games/monop: cards.c

Log Message:
PR/49513 - Henning Petersen -- tyop


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/games/monop/cards.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/monop/cards.c
diff -u src/games/monop/cards.c:1.25 src/games/monop/cards.c:1.26
--- src/games/monop/cards.c:1.25	Tue Jun 19 05:35:32 2012
+++ src/games/monop/cards.c	Mon Dec 29 10:27:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cards.c,v 1.25 2012/06/19 05:35:32 dholland Exp $	*/
+/*	$NetBSD: cards.c,v 1.26 2014/12/29 10:27:03 jnemeth Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)cards.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: cards.c,v 1.25 2012/06/19 05:35:32 dholland Exp $);
+__RCSID($NetBSD: cards.c,v 1.26 2014/12/29 10:27:03 jnemeth Exp $);
 #endif
 #endif /* not lint */
 
@@ -132,7 +132,7 @@ static const struct cardinfo ch_cards[] 
 	{ MU,
 		Advance to the nearest Utility.\n
 		If unowned, you may buy it from the bank.\n
-		If owned, throw dice and pay oner a total of ten times\n
+		If owned, throw dice and pay onwer a total of ten times\n
 		the amount thrown.\n
 	},
 	{ MB3,



CVS commit: src/games/monop

2014-12-29 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon Dec 29 10:38:52 UTC 2014

Modified Files:
src/games/monop: cards.c

Log Message:
PR/49513 - Henning Petersen -- tyop


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/games/monop/cards.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/monop/cards.c
diff -u src/games/monop/cards.c:1.26 src/games/monop/cards.c:1.27
--- src/games/monop/cards.c:1.26	Mon Dec 29 10:27:03 2014
+++ src/games/monop/cards.c	Mon Dec 29 10:38:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cards.c,v 1.26 2014/12/29 10:27:03 jnemeth Exp $	*/
+/*	$NetBSD: cards.c,v 1.27 2014/12/29 10:38:52 jnemeth Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)cards.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: cards.c,v 1.26 2014/12/29 10:27:03 jnemeth Exp $);
+__RCSID($NetBSD: cards.c,v 1.27 2014/12/29 10:38:52 jnemeth Exp $);
 #endif
 #endif /* not lint */
 
@@ -132,7 +132,7 @@ static const struct cardinfo ch_cards[] 
 	{ MU,
 		Advance to the nearest Utility.\n
 		If unowned, you may buy it from the bank.\n
-		If owned, throw dice and pay onwer a total of ten times\n
+		If owned, throw dice and pay owner a total of ten times\n
 		the amount thrown.\n
 	},
 	{ MB3,



CVS commit: src/games/monop

2012-06-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 19 05:35:32 UTC 2012

Modified Files:
src/games/monop: cards.c execute.c getinp.c houses.c jail.c misc.c
monop.c morg.c print.c prop.c rent.c roll.c spec.c trade.c

Log Message:
WARNS=5


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/games/monop/cards.c
cvs rdiff -u -r1.21 -r1.22 src/games/monop/execute.c
cvs rdiff -u -r1.18 -r1.19 src/games/monop/getinp.c src/games/monop/morg.c
cvs rdiff -u -r1.14 -r1.15 src/games/monop/houses.c
cvs rdiff -u -r1.9 -r1.10 src/games/monop/jail.c
cvs rdiff -u -r1.22 -r1.23 src/games/monop/misc.c
cvs rdiff -u -r1.26 -r1.27 src/games/monop/monop.c
cvs rdiff -u -r1.12 -r1.13 src/games/monop/print.c
cvs rdiff -u -r1.19 -r1.20 src/games/monop/prop.c
cvs rdiff -u -r1.8 -r1.9 src/games/monop/rent.c
cvs rdiff -u -r1.13 -r1.14 src/games/monop/roll.c
cvs rdiff -u -r1.10 -r1.11 src/games/monop/spec.c
cvs rdiff -u -r1.15 -r1.16 src/games/monop/trade.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/monop/cards.c
diff -u src/games/monop/cards.c:1.24 src/games/monop/cards.c:1.25
--- src/games/monop/cards.c:1.24	Sun Sep 26 21:12:23 2010
+++ src/games/monop/cards.c	Tue Jun 19 05:35:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cards.c,v 1.24 2010/09/26 21:12:23 dholland Exp $	*/
+/*	$NetBSD: cards.c,v 1.25 2012/06/19 05:35:32 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)cards.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: cards.c,v 1.24 2010/09/26 21:12:23 dholland Exp $);
+__RCSID($NetBSD: cards.c,v 1.25 2012/06/19 05:35:32 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -190,7 +190,7 @@ static const struct cardinfo ch_cards[] 
  * This routine initializes the decks from the data above.
  */
 void
-init_decks()
+init_decks(void)
 {
 	CC_D.info = cc_cards;
 	CC_D.num_cards = sizeof(cc_cards) / sizeof(cc_cards[0]);
@@ -204,8 +204,7 @@ init_decks()
  *	This routine sets up the offset pointers for the given deck.
  */
 static void
-set_up(dp)
-	DECK *dp;
+set_up(DECK *dp)
 {
 	int r1, r2;
 	int i;
@@ -235,8 +234,7 @@ set_up(dp)
  *	This routine draws a card from the given deck
  */
 void
-get_card(dp)
-	DECK *dp;
+get_card(DECK *dp)
 {
 	char type_maj, type_min;
 	int num;
@@ -358,8 +356,7 @@ printmes(const char *text)
  * deck.
  */
 void
-ret_card(plr)
-	PLAY *plr;
+ret_card(PLAY *plr)
 {
 	char type_maj;
 	int gojfpos, last_card;

Index: src/games/monop/execute.c
diff -u src/games/monop/execute.c:1.21 src/games/monop/execute.c:1.22
--- src/games/monop/execute.c:1.21	Sun Feb 24 06:12:49 2008
+++ src/games/monop/execute.c	Tue Jun 19 05:35:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: execute.c,v 1.21 2008/02/24 06:12:49 dholland Exp $	*/
+/*	$NetBSD: execute.c,v 1.22 2012/06/19 05:35:32 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)execute.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: execute.c,v 1.21 2008/02/24 06:12:49 dholland Exp $);
+__RCSID($NetBSD: execute.c,v 1.22 2012/06/19 05:35:32 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -78,8 +78,7 @@ static int getnum_withbrace(const char *
  *	This routine executes the given command by index number
  */
 void
-execute(com_num)
-	int com_num;
+execute(int com_num)
 {
 	new_play = FALSE;	/* new_play is true if fixing	*/
 	(*func[com_num])();
@@ -95,7 +94,7 @@ execute(com_num)
  *	This routine moves a piece around.
  */
 void
-do_move()
+do_move(void)
 {
 	int r1, r2;
 	bool was_jail;
@@ -128,8 +127,7 @@ ret:
  *	This routine moves a normal move
  */
 void
-move(rl)
-	int rl;
+move(int rl)
 {
 	int old_loc;
 
@@ -146,7 +144,7 @@ move(rl)
  *	This routine shows the results of a move
  */
 static void
-show_move()
+show_move(void)
 {
 	SQUARE *sqp;
 
@@ -241,7 +239,7 @@ reset_game(void)
  *	This routine saves the current game for use at a later date
  */
 void
-save()
+save(void)
 {
 	char *sp;
 	FILE *outf;

Index: src/games/monop/getinp.c
diff -u src/games/monop/getinp.c:1.18 src/games/monop/getinp.c:1.19
--- src/games/monop/getinp.c:1.18	Sun Feb 24 01:57:34 2008
+++ src/games/monop/getinp.c	Tue Jun 19 05:35:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getinp.c,v 1.18 2008/02/24 01:57:34 dholland Exp $	*/
+/*	$NetBSD: getinp.c,v 1.19 2012/06/19 05:35:32 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)getinp.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: getinp.c,v 1.18 2008/02/24 01:57:34 dholland Exp $);
+__RCSID($NetBSD: getinp.c,v 1.19 2012/06/19 05:35:32 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -51,8 +51,7 @@ static char	buf[257];
 static int comp(const char *);
 
 int
-getinp(prompt, lst)
-	const char *prompt, *const lst[];
+getinp(const char *prompt, const char *const lst [])
 {
 	int i, n_match, match = 0;
 	char *sp;
@@ -102,8 +101,7 @@ 

CVS commit: src/games/monop

2011-11-30 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Thu Dec  1 07:05:52 UTC 2011

Modified Files:
src/games/monop: misc.c monop.c

Log Message:
handle EOF in input


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/games/monop/misc.c
cvs rdiff -u -r1.25 -r1.26 src/games/monop/monop.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/monop/misc.c
diff -u src/games/monop/misc.c:1.21 src/games/monop/misc.c:1.22
--- src/games/monop/misc.c:1.21	Wed Aug 12 08:10:49 2009
+++ src/games/monop/misc.c	Thu Dec  1 07:05:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.21 2009/08/12 08:10:49 dholland Exp $	*/
+/*	$NetBSD: misc.c,v 1.22 2011/12/01 07:05:52 ahoka Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #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.22 2011/12/01 07:05:52 ahoka Exp $);
 #endif
 #endif /* not lint */
 
@@ -106,8 +106,9 @@ get_int(prompt)
 	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';
@@ -294,6 +295,11 @@ void
 quit()
 {
 	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);
 }

Index: src/games/monop/monop.c
diff -u src/games/monop/monop.c:1.25 src/games/monop/monop.c:1.26
--- src/games/monop/monop.c:1.25	Wed Aug 12 08:10:49 2009
+++ src/games/monop/monop.c	Thu Dec  1 07:05:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: monop.c,v 1.25 2009/08/12 08:10:49 dholland Exp $	*/
+/*	$NetBSD: monop.c,v 1.26 2011/12/01 07:05:52 ahoka Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)monop.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: monop.c,v 1.25 2009/08/12 08:10:49 dholland Exp $);
+__RCSID($NetBSD: monop.c,v 1.26 2011/12/01 07:05:52 ahoka Exp $);
 #endif
 #endif /* not lint */
 
@@ -286,8 +286,7 @@ blew_it:
 			printf(Player %d's name: , i + 1);
 			fgets(buf, sizeof(buf), stdin);
 			if (feof(stdin)) {
-printf(End of file on stdin\n);
-exit(0);
+quit();
 			}
 			buf[strcspn(buf, \n)] = '\0';
 		} while (strlen(buf) == 0);



CVS commit: src/games/monop

2010-09-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Sep 26 21:12:24 UTC 2010

Modified Files:
src/games/monop: cards.c

Log Message:
Avoid undefined behavior, from Chris Spiegel in PR 43860.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/games/monop/cards.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/monop/cards.c
diff -u src/games/monop/cards.c:1.23 src/games/monop/cards.c:1.24
--- src/games/monop/cards.c:1.23	Sun Feb 24 03:56:48 2008
+++ src/games/monop/cards.c	Sun Sep 26 21:12:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cards.c,v 1.23 2008/02/24 03:56:48 christos Exp $	*/
+/*	$NetBSD: cards.c,v 1.24 2010/09/26 21:12:23 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)cards.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: cards.c,v 1.23 2008/02/24 03:56:48 christos Exp $);
+__RCSID($NetBSD: cards.c,v 1.24 2010/09/26 21:12:23 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -247,7 +247,7 @@
 	do {
 		thiscard = dp-info[dp-top_card];
 		type_maj = thiscard-actioncode[0];
-		dp-top_card = ++(dp-top_card) % dp-num_cards;
+		dp-top_card = (dp-top_card + 1) % dp-num_cards;
 	} while (dp-gojf_used  type_maj == GOJF);
 	type_min = thiscard-actioncode[1];
 	num = atoi(thiscard-actioncode+2);