CVS commit: src/games/canfield/canfield

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

Modified Files:
src/games/canfield/canfield: canfield.c

Log Message:
Use ssize_t for read() results. Don't use int for lseek() results.
Call srandom() with time(), not getpid().


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/games/canfield/canfield/canfield.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/canfield/canfield/canfield.c
diff -u src/games/canfield/canfield/canfield.c:1.29 src/games/canfield/canfield/canfield.c:1.30
--- src/games/canfield/canfield/canfield.c:1.29	Sat Mar 22 23:42:48 2014
+++ src/games/canfield/canfield/canfield.c	Sat Mar 22 23:47:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: canfield.c,v 1.29 2014/03/22 23:42:48 dholland Exp $	*/
+/*	$NetBSD: canfield.c,v 1.30 2014/03/22 23:47:03 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)canfield.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: canfield.c,v 1.29 2014/03/22 23:42:48 dholland Exp $");
+__RCSID("$NetBSD: canfield.c,v 1.30 2014/03/22 23:47:03 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -1637,9 +1637,9 @@ instruct(void)
 static void
 initall(void)
 {
-	int i;
+	ssize_t i;
 
-	srandom(getpid());
+	srandom(time(NULL));
 	time(&acctstart);
 	initdeck(deck);
 	uid = getuid();
@@ -1652,8 +1652,7 @@ initall(void)
 		return;
 	if (dbfd < 3)
 		exit(1);
-	i = lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET);
-	if (i < 0) {
+	if (lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET) < 0) {
 		close(dbfd);
 		dbfd = -1;
 		return;



CVS commit: src/games/canfield/canfield

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

Modified Files:
src/games/canfield/canfield: canfield.c

Log Message:
Use uid_t to hold getuid() results, and don't check getuid for failure
as it isn't allowed to fail.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/games/canfield/canfield/canfield.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/canfield/canfield/canfield.c
diff -u src/games/canfield/canfield/canfield.c:1.28 src/games/canfield/canfield/canfield.c:1.29
--- src/games/canfield/canfield/canfield.c:1.28	Mon May 23 22:46:35 2011
+++ src/games/canfield/canfield/canfield.c	Sat Mar 22 23:42:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: canfield.c,v 1.28 2011/05/23 22:46:35 joerg Exp $	*/
+/*	$NetBSD: canfield.c,v 1.29 2014/03/22 23:42:48 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)canfield.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: canfield.c,v 1.28 2011/05/23 22:46:35 joerg Exp $");
+__RCSID("$NetBSD: canfield.c,v 1.29 2014/03/22 23:42:48 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -168,7 +168,7 @@ static bool mtfdone, Cflag = FALSE;
 #define BETTINGBOX	2
 #define NOBOX		3
 static int status = INSTRUCTIONBOX;
-static int uid;
+static uid_t uid;
 
 /*
  * Basic betting costs
@@ -1643,8 +1643,6 @@ initall(void)
 	time(&acctstart);
 	initdeck(deck);
 	uid = getuid();
-	if (uid < 0)
-		uid = 0;
 	dbfd = open(_PATH_SCORE, O_RDWR);
 
 	/* Revoke setgid privileges */



CVS commit: src/games/canfield/canfield

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

Modified Files:
src/games/canfield/canfield: canfield.c

Log Message:
Don't use strings from arrays as format string.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/games/canfield/canfield/canfield.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/canfield/canfield/canfield.c
diff -u src/games/canfield/canfield/canfield.c:1.27 src/games/canfield/canfield/canfield.c:1.28
--- src/games/canfield/canfield/canfield.c:1.27	Fri Jan  1 06:37:15 2010
+++ src/games/canfield/canfield/canfield.c	Mon May 23 22:46:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: canfield.c,v 1.27 2010/01/01 06:37:15 dholland Exp $	*/
+/*	$NetBSD: canfield.c,v 1.28 2011/05/23 22:46:35 joerg Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)canfield.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: canfield.c,v 1.27 2010/01/01 06:37:15 dholland Exp $");
+__RCSID("$NetBSD: canfield.c,v 1.28 2011/05/23 22:46:35 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -1613,7 +1613,7 @@
 		return;
 	clear();
 	for (cp = basicinstructions; *cp != 0; cp++)
-		printw(*cp);
+		printw("%s", *cp);
 	refresh();
 	getch();
 	clear();
@@ -1626,7 +1626,7 @@
 		return;
 	clear();
 	for (cp = bettinginstructions; *cp != 0; cp++)
-		printw(*cp);
+		printw("%s", *cp);
 	refresh();
 	getch();
 }



CVS commit: src/games/canfield/canfield

2010-01-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jan  1 11:45:34 UTC 2010

Modified Files:
src/games/canfield/canfield: canfield.6

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/games/canfield/canfield/canfield.6

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

Modified files:

Index: src/games/canfield/canfield/canfield.6
diff -u src/games/canfield/canfield/canfield.6:1.11 src/games/canfield/canfield/canfield.6:1.12
--- src/games/canfield/canfield/canfield.6:1.11	Fri Jan  1 07:35:09 2010
+++ src/games/canfield/canfield/canfield.6	Fri Jan  1 11:45:34 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: canfield.6,v 1.11 2010/01/01 07:35:09 dholland Exp $
+.\"	$NetBSD: canfield.6,v 1.12 2010/01/01 11:45:34 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -44,17 +44,19 @@
 .Fl a
 .Sh DESCRIPTION
 If you have never played solitaire before, it is recommended
-that you consult a solitaire instruction book. In
-Canfield, tableau cards may be built on each other downward
-in alternate colors. An entire pile must be moved as a unit
-in building. Top cards of the piles are available
-to be played on foundations, but never into empty spaces.
-.Pp
-Spaces must be filled from the stock. The top card of
-the stock also is available to be played on foundations or
-built on tableau piles. After the stock is exhausted,
-tableau spaces may be filled from the talon and the player may
-keep them open until he wishes to use them.
+that you consult a solitaire instruction book.
+In Canfield, tableau cards may be built on each other downward in
+alternate colors.
+An entire pile must be moved as a unit in building.
+Top cards of the piles are available to be played on foundations,
+but never into empty spaces.
+.Pp
+Spaces must be filled from the stock.
+The top card of the stock also is available to be played on
+foundations or built on tableau piles.
+After the stock is exhausted, tableau spaces may be filled from
+the talon and the player may keep them open until he wishes to use
+them.
 .Pp
 Cards are dealt from the hand to the talon by threes
 and this repeats until there are no more cards in the hand



CVS commit: src/games/canfield/canfield

2009-12-31 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Jan  1 07:35:09 UTC 2010

Modified Files:
src/games/canfield/canfield: canfield.6

Log Message:
Adjust SYNOPSIS for cfscores to better match reality. Note in BUGS
that the score file isn't portable. Bump date (first time since 1993,
and first in 2010...)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/games/canfield/canfield/canfield.6

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

Modified files:

Index: src/games/canfield/canfield/canfield.6
diff -u src/games/canfield/canfield/canfield.6:1.10 src/games/canfield/canfield/canfield.6:1.11
--- src/games/canfield/canfield/canfield.6:1.10	Thu Sep 15 02:09:41 2005
+++ src/games/canfield/canfield/canfield.6	Fri Jan  1 07:35:09 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: canfield.6,v 1.10 2005/09/15 02:09:41 wiz Exp $
+.\"	$NetBSD: canfield.6,v 1.11 2010/01/01 07:35:09 dholland Exp $
 .\"
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)canfield.6	8.1 (Berkeley) 5/31/93
 .\"
-.Dd May 31, 1993
+.Dd January 1, 2010
 .Dt CANFIELD 6
 .Os
 .Sh NAME
@@ -39,8 +39,9 @@
 .Sh SYNOPSIS
 .Nm
 .Nm cfscores
-.Op Fl a
 .Op Ar user
+.Nm cfscores
+.Fl a
 .Sh DESCRIPTION
 If you have never played solitaire before, it is recommended
 that you consult a solitaire instruction book. In
@@ -120,3 +121,5 @@
 Mikey Olson, and Eric Allman.
 .Sh BUGS
 It is impossible to cheat.
+.Pp
+The score file database is not portable.