CVS commit: src/games/battlestar

2020-12-06 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Dec  6 11:35:27 UTC 2020

Modified Files:
src/games/battlestar: globals.c

Log Message:
speed limit 80


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/games/battlestar/globals.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/battlestar/globals.c
diff -u src/games/battlestar/globals.c:1.19 src/games/battlestar/globals.c:1.20
--- src/games/battlestar/globals.c:1.19	Thu Aug  7 09:37:02 2003
+++ src/games/battlestar/globals.c	Sun Dec  6 11:35:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: globals.c,v 1.19 2003/08/07 09:37:02 agc Exp $	*/
+/*	$NetBSD: globals.c,v 1.20 2020/12/06 11:35:27 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)globals.c	8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: globals.c,v 1.19 2003/08/07 09:37:02 agc Exp $");
+__RCSID("$NetBSD: globals.c,v 1.20 2020/12/06 11:35:27 dholland Exp $");
 #endif
 #endif/* not lint */
 
@@ -67,7 +67,8 @@ const char   *const objdes[NUMOFOBJECTS]
 	"A dead woodsman has fallen here. He was savagely murdered.",
 	"A heavy wooden mallet lies nearby.",
 	"There is a laser pistol here.",
-	"A flower-like young goddess is bathing in the hot mineral pools. She is \nwatching you, but continues to steep and sing softly.",
+	"A flower-like young goddess is bathing in the hot mineral pools. She "
+		"is \nwatching you, but continues to steep and sing softly.",
 	"The goddess is reclining on a bed of ferns and studying you intently.",
 	"There is a grenade here.",
 	"There is a length of heavy chain here.",
@@ -78,7 +79,8 @@ const char   *const objdes[NUMOFOBJECTS]
 	"A long, sharp halberd is propped up here.",
 	"There is a compass here.",
 	"Wreckage and smoldering debris from a crash litter the ground here.",
-	"A woodland Elf armed with a shield and deadly halberd lunges toward you!",
+	"A woodland Elf armed with a shield and deadly halberd lunges toward "
+		"you!",
 	"I think I hear footsteps behind us.",
 	"There are a few coins here.",
 	"There are some matches here.",
@@ -91,15 +93,28 @@ const char   *const objdes[NUMOFOBJECTS]
 	"There is a sparkling diamond ring here.",
 	"There is a colorful pink potion in a small crystal vial here.",
 	"A gold bracelet is on the ground here.",
-	"A swarthy woman with stern features pulls you aside from the crowd,\n'I must talk to you -- but not here.  Meet me at midnight in the gardens.'",
-	"The swarthy woman has been awaiting you anxiously. 'I must warn you that the\nIsland has anticipated your Quest.  You will not be welcomed. The Darkness is\nstrong where you must search.  Seek not the shadows save only at night, for\nthen are they the weakest.  In the mountains far from here a canyon winds\nwith ferns and streams and forgotten vines.  There you must go. Take this\nrope.'",
-	"Out from the shadows a figure leaps!  His black cape swirls around, and he\nholds a laser sword at your chest.  'So, you have come to fulfill the Quest.\nHa! Your weapons are no match for me!'",
-	"An old-timer with one eye missing and no money for a drink sits at the bar.",
+	"A swarthy woman with stern features pulls you aside from the crowd,\n"
+		"'I must talk to you -- but not here.  "
+		"Meet me at midnight in the gardens.'",
+	"The swarthy woman has been awaiting you anxiously. 'I must warn you "
+		"that the\nIsland has anticipated your Quest.  You will not be "
+		"welcomed. The Darkness is\nstrong where you must search.  Seek"
+		" not the shadows save only at night, for\nthen are they the "
+		"weakest.  In the mountains far from here a canyon winds\nwith "
+		"ferns and streams and forgotten vines.  There you must go. "
+		"Take this\nrope.'",
+	"Out from the shadows a figure leaps!  His black cape swirls around,"
+		" and he\nholds a laser sword at your chest.  'So, you have"
+		" come to fulfill the Quest.\nHa! Your weapons are no match for"
+		" me!'",
+	"An old-timer with one eye missing and no money for a drink sits at the"
+		" bar.",
 	"You are flying through an asteroid field!",
 	"A planet is nearby.",
 	"The ground is charred here.",
 	"There is a thermonuclear warhead here.",
-	"The fragile, beautiful young goddess lies here.  You murdered her horribly.",
+	"The fragile, beautiful young goddess lies here.  You murdered her "
+		"horribly.",
 	"The old-timer is lying here.  He is dead.",
 	"The native girl's body is lying here.",
 	"A native girl is sitting here.",



CVS commit: src/games/battlestar

2020-02-06 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Thu Feb  6 22:09:43 UTC 2020

Modified Files:
src/games/battlestar: parse.c

Log Message:
games/battlestar: Replace snprintf(3) with strlcpy(3) for better performance.

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/games/battlestar/parse.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/battlestar/parse.c
diff -u src/games/battlestar/parse.c:1.16 src/games/battlestar/parse.c:1.17
--- src/games/battlestar/parse.c:1.16	Wed Feb  5 20:11:54 2020
+++ src/games/battlestar/parse.c	Thu Feb  6 22:09:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.16 2020/02/05 20:11:54 fox Exp $	*/
+/*	$NetBSD: parse.c,v 1.17 2020/02/06 22:09:43 fox Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)parse.c	8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: parse.c,v 1.16 2020/02/05 20:11:54 fox Exp $");
+__RCSID("$NetBSD: parse.c,v 1.17 2020/02/06 22:09:43 fox Exp $");
 #endif
 #endif/* not lint */
 
@@ -120,7 +120,7 @@ parse(void)
 			for (i = n + 1; i < wordcount; i++) {
 wordtype[i - 1] = wordtype[i];
 wordvalue[i - 1] = wordvalue[i];
-snprintf(words[i - 1], WORDLEN, "%s", words[i]);
+strlcpy(words[i - 1], words[i], WORDLEN);
 			}
 			wordcount--;
 		}
@@ -140,7 +140,7 @@ parse(void)
 			for (i = n + 1; i < wordcount; i++) {
 wordtype[i - 1] = wordtype[i];
 wordvalue[i - 1] = wordvalue[i];
-snprintf(words[i - 1], WORDLEN, "%s", words[i]);
+strlcpy(words[i - 1], words[i], WORDLEN);
 			}
 			wordcount--;
 		}
@@ -164,7 +164,7 @@ parse(void)
 wordtype[n + 1] = wordtype[n - 1];
 wordtype[n - 1] = OBJECT;
 strcpy(tmpword, words[n - 1]);
-snprintf(words[n - 1], WORDLEN, "%s", words[n + 1]);
+strlcpy(words[n - 1], words[n + 1], WORDLEN);
 strcpy(words[n + 1], tmpword);
 flag = 1;
 		}
@@ -177,7 +177,7 @@ parse(void)
 for (i = n + 1; i < wordcount; i++) {
 	wordtype[i - 1] = wordtype[i + 1];
 	wordvalue[i - 1] = wordvalue[i + 1];
-	snprintf(words[i - 1], WORDLEN, "%s", words[i + 1]);
+	strlcpy(words[i - 1], words[i + 1], WORDLEN);
 }
 wordcount--;
 wordcount--;



CVS commit: src/games/battlestar

2020-02-05 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Wed Feb  5 20:11:54 UTC 2020

Modified Files:
src/games/battlestar: parse.c

Log Message:
games/battlestar: Fix the -Werror=restrict warning.

Replace strcpy(1) with the safer snprintf(3) which guarantees NULL
termination of strings.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/games/battlestar/parse.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/battlestar/parse.c
diff -u src/games/battlestar/parse.c:1.15 src/games/battlestar/parse.c:1.16
--- src/games/battlestar/parse.c:1.15	Fri Jul  1 06:04:54 2005
+++ src/games/battlestar/parse.c	Wed Feb  5 20:11:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.15 2005/07/01 06:04:54 jmc Exp $	*/
+/*	$NetBSD: parse.c,v 1.16 2020/02/05 20:11:54 fox Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)parse.c	8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: parse.c,v 1.15 2005/07/01 06:04:54 jmc Exp $");
+__RCSID("$NetBSD: parse.c,v 1.16 2020/02/05 20:11:54 fox Exp $");
 #endif
 #endif/* not lint */
 
@@ -120,7 +120,7 @@ parse(void)
 			for (i = n + 1; i < wordcount; i++) {
 wordtype[i - 1] = wordtype[i];
 wordvalue[i - 1] = wordvalue[i];
-strcpy(words[i - 1], words[i]);
+snprintf(words[i - 1], WORDLEN, "%s", words[i]);
 			}
 			wordcount--;
 		}
@@ -140,7 +140,7 @@ parse(void)
 			for (i = n + 1; i < wordcount; i++) {
 wordtype[i - 1] = wordtype[i];
 wordvalue[i - 1] = wordvalue[i];
-strcpy(words[i - 1], words[i]);
+snprintf(words[i - 1], WORDLEN, "%s", words[i]);
 			}
 			wordcount--;
 		}
@@ -164,7 +164,7 @@ parse(void)
 wordtype[n + 1] = wordtype[n - 1];
 wordtype[n - 1] = OBJECT;
 strcpy(tmpword, words[n - 1]);
-strcpy(words[n - 1], words[n + 1]);
+snprintf(words[n - 1], WORDLEN, "%s", words[n + 1]);
 strcpy(words[n + 1], tmpword);
 flag = 1;
 		}
@@ -177,7 +177,7 @@ parse(void)
 for (i = n + 1; i < wordcount; i++) {
 	wordtype[i - 1] = wordtype[i + 1];
 	wordvalue[i - 1] = wordvalue[i + 1];
-	strcpy(words[i - 1], words[i + 1]);
+	snprintf(words[i - 1], WORDLEN, "%s", words[i + 1]);
 }
 wordcount--;
 wordcount--;



CVS commit: src/games/battlestar

2014-03-22 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Mar 22 23:16:21 UTC 2014

Modified Files:
src/games/battlestar: extern.h

Log Message:
Use CHAR_BIT, not 8.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/games/battlestar/extern.h

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

Modified files:

Index: src/games/battlestar/extern.h
diff -u src/games/battlestar/extern.h:1.33 src/games/battlestar/extern.h:1.34
--- src/games/battlestar/extern.h:1.33	Fri Aug 26 06:18:17 2011
+++ src/games/battlestar/extern.h	Sat Mar 22 23:16:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.33 2011/08/26 06:18:17 dholland Exp $ */
+/*	$NetBSD: extern.h,v 1.34 2014/03/22 23:16:21 dholland Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,10 +38,11 @@
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include limits.h
 #include time.h
 #include unistd.h
 
-#define BITS (8 * sizeof (int))
+#define BITS (CHAR_BIT * sizeof (int))
 
 #define OUTSIDE		(position  68  position  246  position != 218)
 #define rnd(x)		(rand() % (x))



CVS commit: src/games/battlestar

2014-03-22 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Mar 22 23:23:55 UTC 2014

Modified Files:
src/games/battlestar: extern.h

Log Message:
avoid signed left-shift


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/games/battlestar/extern.h

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

Modified files:

Index: src/games/battlestar/extern.h
diff -u src/games/battlestar/extern.h:1.34 src/games/battlestar/extern.h:1.35
--- src/games/battlestar/extern.h:1.34	Sat Mar 22 23:16:21 2014
+++ src/games/battlestar/extern.h	Sat Mar 22 23:23:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.34 2014/03/22 23:16:21 dholland Exp $ */
+/*	$NetBSD: extern.h,v 1.35 2014/03/22 23:23:55 dholland Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -42,14 +42,14 @@
 #include time.h
 #include unistd.h
 
-#define BITS (CHAR_BIT * sizeof (int))
+#define BITS (CHAR_BIT * sizeof (unsigned int))
 
 #define OUTSIDE		(position  68  position  246  position != 218)
 #define rnd(x)		(rand() % (x))
 #define max(a,b)	((a)  (b) ? (b) : (a))
-#define testbit(array, index)	(array[index/BITS]  (1  (index % BITS)))
-#define setbit(array, index)	(array[index/BITS] |= (1  (index % BITS)))
-#define clearbit(array, index)	(array[index/BITS] = ~(1  (index % BITS)))
+#define testbit(array, index)	(array[index/BITS]  (1U  (index % BITS)))
+#define setbit(array, index)	(array[index/BITS] |= (1U  (index % BITS)))
+#define clearbit(array, index)	(array[index/BITS] = ~(1U  (index % BITS)))
 
  /* well known rooms */
 #define FINAL	275



CVS commit: src/games/battlestar

2014-03-22 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Mar 22 23:31:28 UTC 2014

Modified Files:
src/games/battlestar: command5.c

Log Message:
avoid unnecessary floating point ops


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/games/battlestar/command5.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/battlestar/command5.c
diff -u src/games/battlestar/command5.c:1.4 src/games/battlestar/command5.c:1.5
--- src/games/battlestar/command5.c:1.4	Tue Jun 19 05:46:08 2012
+++ src/games/battlestar/command5.c	Sat Mar 22 23:31:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: command5.c,v 1.4 2012/06/19 05:46:08 dholland Exp $	*/
+/*	$NetBSD: command5.c,v 1.5 2014/03/22 23:31:28 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)com5.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: command5.c,v 1.4 2012/06/19 05:46:08 dholland Exp $);
+__RCSID($NetBSD: command5.c,v 1.5 2014/03/22 23:31:28 dholland Exp $);
 #endif
 #endif/* not lint */
 
@@ -186,10 +186,13 @@ zzz(void)
 {
 	int oldtime;
 	int n;
+	int zzztime;
+
+	zzztime = (3 * CYCLE) / 4;
 
 	oldtime = ourtime;
-	if ((snooze - ourtime)  (0.75 * CYCLE)) {
-		ourtime += 0.75 * CYCLE - (snooze - ourtime);
+	if ((snooze - ourtime)  zzztime) {
+		ourtime += zzztime - (snooze - ourtime);
 		printf(zzz);
 		for (n = 0; n  ourtime - oldtime; n++)
 			printf(.);



CVS commit: src/games/battlestar

2014-03-22 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Mar 22 23:33:33 UTC 2014

Modified Files:
src/games/battlestar: extern.h init.c

Log Message:
Use random(), not rand().


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/games/battlestar/extern.h
cvs rdiff -u -r1.15 -r1.16 src/games/battlestar/init.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/battlestar/extern.h
diff -u src/games/battlestar/extern.h:1.35 src/games/battlestar/extern.h:1.36
--- src/games/battlestar/extern.h:1.35	Sat Mar 22 23:23:55 2014
+++ src/games/battlestar/extern.h	Sat Mar 22 23:33:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.35 2014/03/22 23:23:55 dholland Exp $ */
+/*	$NetBSD: extern.h,v 1.36 2014/03/22 23:33:33 dholland Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -45,7 +45,7 @@
 #define BITS (CHAR_BIT * sizeof (unsigned int))
 
 #define OUTSIDE		(position  68  position  246  position != 218)
-#define rnd(x)		(rand() % (x))
+#define rnd(x)		(random() % (x))
 #define max(a,b)	((a)  (b) ? (b) : (a))
 #define testbit(array, index)	(array[index/BITS]  (1U  (index % BITS)))
 #define setbit(array, index)	(array[index/BITS] |= (1U  (index % BITS)))

Index: src/games/battlestar/init.c
diff -u src/games/battlestar/init.c:1.15 src/games/battlestar/init.c:1.16
--- src/games/battlestar/init.c:1.15	Fri Jul  1 06:04:54 2005
+++ src/games/battlestar/init.c	Sat Mar 22 23:33:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.15 2005/07/01 06:04:54 jmc Exp $	*/
+/*	$NetBSD: init.c,v 1.16 2014/03/22 23:33:33 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)init.c	8.4 (Berkeley) 4/30/95;
 #else
-__RCSID($NetBSD: init.c,v 1.15 2005/07/01 06:04:54 jmc Exp $);
+__RCSID($NetBSD: init.c,v 1.16 2014/03/22 23:33:33 dholland Exp $);
 #endif
 #endif/* not lint */
 
@@ -54,7 +54,7 @@ initialize(const char *filename)
 	puts(First Adventure game written by His Lordship, the honorable);
 	puts(Admiral D.W. Riggle\n);
 	location = dayfile;
-	srand(getpid());
+	srandom(time(NULL));
 	username = getutmp();
 	wordinit();
 	if (filename == NULL) {



CVS commit: src/games/battlestar

2012-10-13 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Oct 13 19:58:54 UTC 2012

Modified Files:
src/games/battlestar: fly.c

Log Message:
Pass -Wstrict-overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/games/battlestar/fly.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/battlestar/fly.c
diff -u src/games/battlestar/fly.c:1.14 src/games/battlestar/fly.c:1.15
--- src/games/battlestar/fly.c:1.14	Sat Dec 15 19:44:39 2007
+++ src/games/battlestar/fly.c	Sat Oct 13 19:58:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fly.c,v 1.14 2007/12/15 19:44:39 perry Exp $	*/
+/*	$NetBSD: fly.c,v 1.15 2012/10/13 19:58:53 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,13 +34,14 @@
 #if 0
 static char sccsid[] = @(#)fly.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: fly.c,v 1.14 2007/12/15 19:44:39 perry Exp $);
+__RCSID($NetBSD: fly.c,v 1.15 2012/10/13 19:58:53 dholland Exp $);
 #endif
 #endif/* not lint */
 
 #include extern.h
 #undef UP
 #include curses.h
+#include assert.h
 
 #define MIDR  (LINES/2 - 1)
 #define MIDC  (COLS/2 - 1)
@@ -150,8 +151,8 @@ visual(void)
 			if (torps) {
 torps -= 2;
 blast();
-if (row == MIDR  column - MIDC  2  
-MIDC - column  2) {
+if (row == MIDR  column  MIDC + 2  
+column  MIDC - 2) {
 	destroyed = 1;
 	alarm(0);
 }



CVS commit: src/games/battlestar

2011-05-23 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon May 23 22:44:18 UTC 2011

Modified Files:
src/games/battlestar: room.c

Log Message:
Don't use return value of a function as format string.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/games/battlestar/room.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/battlestar/room.c
diff -u src/games/battlestar/room.c:1.12 src/games/battlestar/room.c:1.13
--- src/games/battlestar/room.c:1.12	Fri Jul  1 06:04:54 2005
+++ src/games/battlestar/room.c	Mon May 23 22:44:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: room.c,v 1.12 2005/07/01 06:04:54 jmc Exp $	*/
+/*	$NetBSD: room.c,v 1.13 2011/05/23 22:44:18 joerg Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)room.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: room.c,v 1.12 2005/07/01 06:04:54 jmc Exp $);
+__RCSID($NetBSD: room.c,v 1.13 2011/05/23 22:44:18 joerg Exp $);
 #endif
 #endif/* not lint */
 
@@ -58,7 +58,7 @@
 	putchar(c);
 			} else {
 if (c != '*')
-	printf(truedirec(compass, c));
+	printf(%s, truedirec(compass, c));
 compass++;
 			}
 	}



CVS commit: src/games/battlestar

2010-04-23 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Apr 24 00:38:30 UTC 2010

Modified Files:
src/games/battlestar: command6.c

Log Message:
fflush the score file while signals are blocked to decrease the chance of
it getting corrupted.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/games/battlestar/command6.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/battlestar/command6.c
diff -u src/games/battlestar/command6.c:1.7 src/games/battlestar/command6.c:1.8
--- src/games/battlestar/command6.c:1.7	Fri Apr  2 19:34:44 2010
+++ src/games/battlestar/command6.c	Sat Apr 24 00:38:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: command6.c,v 1.7 2010/04/02 19:34:44 christos Exp $	*/
+/*	$NetBSD: command6.c,v 1.8 2010/04/24 00:38:30 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)com6.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: command6.c,v 1.7 2010/04/02 19:34:44 christos Exp $);
+__RCSID($NetBSD: command6.c,v 1.8 2010/04/24 00:38:30 dholland Exp $);
 #endif
 #endif/* not lint */
 
@@ -137,6 +137,7 @@
 			else
 fprintf(score_fp, \n);
 	}
+	fflush(score_fp);
 	sigprocmask(SIG_SETMASK, osigset, (sigset_t *) 0);
 }
 



CVS commit: src/games/battlestar

2010-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  2 15:35:32 UTC 2010

Modified Files:
src/games/battlestar: command6.c

Log Message:
handle ctime returning NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/games/battlestar/command6.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/battlestar/command6.c
diff -u src/games/battlestar/command6.c:1.5 src/games/battlestar/command6.c:1.6
--- src/games/battlestar/command6.c:1.5	Wed Aug 12 01:20:38 2009
+++ src/games/battlestar/command6.c	Fri Apr  2 11:35:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: command6.c,v 1.5 2009/08/12 05:20:38 dholland Exp $	*/
+/*	$NetBSD: command6.c,v 1.6 2010/04/02 15:35:32 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)com6.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: command6.c,v 1.5 2009/08/12 05:20:38 dholland Exp $);
+__RCSID($NetBSD: command6.c,v 1.6 2010/04/02 15:35:32 christos Exp $);
 #endif
 #endif/* not lint */
 
@@ -120,17 +120,14 @@
 post(int ch)
 {
 	time_t tv;
-	char   *date;
 	sigset_t isigset, osigset;
 
 	sigemptyset(isigset);
 	sigaddset(isigset, SIGINT);
 	sigprocmask(SIG_BLOCK, isigset, osigset);
 	tv = time(NULL);
-	date = ctime(tv);
-	date[24] = '\0';
 	if (score_fp != NULL) {
-		fprintf(score_fp, %s  %8s  %c%20s, date, username, 
+		fprintf(score_fp, %24.24s  %8s  %c%20s, ctime(t), username, 
 		ch, rate());
 		if (wiz)
 			fprintf(score_fp,wizard\n);



CVS commit: src/games/battlestar

2010-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  2 19:34:44 UTC 2010

Modified Files:
src/games/battlestar: command6.c

Log Message:
fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/games/battlestar/command6.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/battlestar/command6.c
diff -u src/games/battlestar/command6.c:1.6 src/games/battlestar/command6.c:1.7
--- src/games/battlestar/command6.c:1.6	Fri Apr  2 11:35:32 2010
+++ src/games/battlestar/command6.c	Fri Apr  2 15:34:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: command6.c,v 1.6 2010/04/02 15:35:32 christos Exp $	*/
+/*	$NetBSD: command6.c,v 1.7 2010/04/02 19:34:44 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)com6.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: command6.c,v 1.6 2010/04/02 15:35:32 christos Exp $);
+__RCSID($NetBSD: command6.c,v 1.7 2010/04/02 19:34:44 christos Exp $);
 #endif
 #endif/* not lint */
 
@@ -127,7 +127,7 @@
 	sigprocmask(SIG_BLOCK, isigset, osigset);
 	tv = time(NULL);
 	if (score_fp != NULL) {
-		fprintf(score_fp, %24.24s  %8s  %c%20s, ctime(t), username, 
+		fprintf(score_fp, %24.24s  %8s  %c%20s, ctime(tv), username, 
 		ch, rate());
 		if (wiz)
 			fprintf(score_fp,wizard\n);



CVS commit: src/games/battlestar

2009-08-11 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug 12 05:20:38 UTC 2009

Modified Files:
src/games/battlestar: command1.c command6.c extern.h

Log Message:
sprinkle static


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/games/battlestar/command1.c
cvs rdiff -u -r1.4 -r1.5 src/games/battlestar/command6.c
cvs rdiff -u -r1.31 -r1.32 src/games/battlestar/extern.h

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

Modified files:

Index: src/games/battlestar/command1.c
diff -u src/games/battlestar/command1.c:1.3 src/games/battlestar/command1.c:1.4
--- src/games/battlestar/command1.c:1.3	Fri Jul  1 06:04:54 2005
+++ src/games/battlestar/command1.c	Wed Aug 12 05:20:38 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: command1.c,v 1.3 2005/07/01 06:04:54 jmc Exp $	*/
+/*	$NetBSD: command1.c,v 1.4 2009/08/12 05:20:38 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,12 +34,14 @@
 #if 0
 static char sccsid[] = @(#)com1.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: command1.c,v 1.3 2005/07/01 06:04:54 jmc Exp $);
+__RCSID($NetBSD: command1.c,v 1.4 2009/08/12 05:20:38 dholland Exp $);
 #endif
 #endif/* not lint */
 
 #include extern.h
 
+static void convert(int);
+
 int
 moveplayer(int thataway, int token)
 {
@@ -70,7 +72,7 @@
 }
 
 /* Converts day to night and vice versa. 	*/
-void
+static void
 convert(int tothis)
 {
 	const struct objs *p;

Index: src/games/battlestar/command6.c
diff -u src/games/battlestar/command6.c:1.4 src/games/battlestar/command6.c:1.5
--- src/games/battlestar/command6.c:1.4	Sat Dec 15 19:44:39 2007
+++ src/games/battlestar/command6.c	Wed Aug 12 05:20:38 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: command6.c,v 1.4 2007/12/15 19:44:39 perry Exp $	*/
+/*	$NetBSD: command6.c,v 1.5 2009/08/12 05:20:38 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,13 +34,15 @@
 #if 0
 static char sccsid[] = @(#)com6.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: command6.c,v 1.4 2007/12/15 19:44:39 perry Exp $);
+__RCSID($NetBSD: command6.c,v 1.5 2009/08/12 05:20:38 dholland Exp $);
 #endif
 #endif/* not lint */
 
 #include extern.h
 #include pathnames.h
 
+static void post(int);
+
 int
 launch(void)
 {
@@ -114,7 +116,7 @@
 		exit(1);
 }
 
-void
+static void
 post(int ch)
 {
 	time_t tv;

Index: src/games/battlestar/extern.h
diff -u src/games/battlestar/extern.h:1.31 src/games/battlestar/extern.h:1.32
--- src/games/battlestar/extern.h:1.31	Fri Jul  1 06:04:54 2005
+++ src/games/battlestar/extern.h	Wed Aug 12 05:20:38 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.31 2005/07/01 06:04:54 jmc Exp $ */
+/*	$NetBSD: extern.h,v 1.32 2009/08/12 05:20:38 dholland Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -331,7 +331,6 @@
 void bury(void);
 int card(const char *, int);
 void chime(void);
-void convert(int);
 void crash(void);
 int cypher(void);
 void die(void) __attribute__((__noreturn__));
@@ -362,7 +361,6 @@
 void newway(int);
 void open_score_file(void);
 void parse(void);
-void post(int);
 void printobjs(void);
 int put(void);
 int puton(void);