Module Name: src Committed By: christos Date: Fri Jan 6 17:13:46 UTC 2023
Modified Files: src/games/cribbage: crib.c cribbage.6 extern.c Log Message: PR/57164: Greywolf: Add -y to cribbage to keep playing without asking To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/games/cribbage/crib.c cvs rdiff -u -r1.11 -r1.12 src/games/cribbage/cribbage.6 cvs rdiff -u -r1.7 -r1.8 src/games/cribbage/extern.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/cribbage/crib.c diff -u src/games/cribbage/crib.c:1.25 src/games/cribbage/crib.c:1.26 --- src/games/cribbage/crib.c:1.25 Sat Oct 13 16:36:06 2012 +++ src/games/cribbage/crib.c Fri Jan 6 12:13:46 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: crib.c,v 1.25 2012/10/13 20:36:06 dholland Exp $ */ +/* $NetBSD: crib.c,v 1.26 2023/01/06 17:13:46 christos Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)crib.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: crib.c,v 1.25 2012/10/13 20:36:06 dholland Exp $"); +__RCSID("$NetBSD: crib.c,v 1.26 2023/01/06 17:13:46 christos Exp $"); #endif #endif /* not lint */ @@ -97,7 +97,7 @@ main(int argc, char *argv[]) err(1, "fcntl F_SETFD"); } - while ((ch = getopt(argc, argv, "eqr")) != -1) + while ((ch = getopt(argc, argv, "eqry")) != -1) switch (ch) { case 'e': explain = TRUE; @@ -108,9 +108,12 @@ main(int argc, char *argv[]) case 'r': rflag = TRUE; break; + case 'y': + yes = TRUE; + break; case '?': default: - (void) fprintf(stderr, "usage: cribbage [-eqr]\n"); + (void) fprintf(stderr, "usage: cribbage [-eqry]\n"); exit(1); } @@ -154,7 +157,10 @@ main(int argc, char *argv[]) glimit = (getuchar() == 'S' ? SGAME : LGAME); game(); msg("Another game? "); - playing = (getuchar() == 'Y'); + if (!yes) + playing = (getuchar() == 'Y'); + else + playing = (getuchar() != 'N'); } while (playing); if (f != NULL) { Index: src/games/cribbage/cribbage.6 diff -u src/games/cribbage/cribbage.6:1.11 src/games/cribbage/cribbage.6:1.12 --- src/games/cribbage/cribbage.6:1.11 Thu Aug 7 05:37:09 2003 +++ src/games/cribbage/cribbage.6 Fri Jan 6 12:13:46 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: cribbage.6,v 1.11 2003/08/07 09:37:09 agc Exp $ +.\" $NetBSD: cribbage.6,v 1.12 2023/01/06 17:13:46 christos Exp $ .\" .\" Copyright (c) 1980, 1993 .\" The Regents of the University of California. All rights reserved. @@ -61,6 +61,9 @@ users who have played the game without s .It Fl r Instead of asking the player to cut the deck, the program will randomly cut the deck. +.It Fl y +Assume 'Y' to the query for another game if 'Y' is not explicitly typed +(default is to exit unless 'Y' is typed). .El .Pp .Nm Index: src/games/cribbage/extern.c diff -u src/games/cribbage/extern.c:1.7 src/games/cribbage/extern.c:1.8 --- src/games/cribbage/extern.c:1.7 Thu Aug 7 05:37:10 2003 +++ src/games/cribbage/extern.c Fri Jan 6 12:13:46 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.c,v 1.7 2003/08/07 09:37:10 agc Exp $ */ +/* $NetBSD: extern.c,v 1.8 2023/01/06 17:13:46 christos Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: extern.c,v 1.7 2003/08/07 09:37:10 agc Exp $"); +__RCSID("$NetBSD: extern.c,v 1.8 2023/01/06 17:13:46 christos Exp $"); #endif #endif /* not lint */ @@ -47,6 +47,7 @@ BOOLEAN explain = FALSE; /* player mist BOOLEAN iwon = FALSE; /* if comp won last game */ BOOLEAN quiet = FALSE; /* if suppress random mess */ BOOLEAN rflag = FALSE; /* if all cuts random */ +BOOLEAN yes = FALSE; /* default 'y' to "Another game?" */ char explan[128]; /* explanation */