CVS commit: src/games/backgammon
Module Name:src Committed By: mrg Date: Mon Mar 22 05:10:19 UTC 2010 Modified Files: src/games/backgammon/backgammon: main.c text.c src/games/backgammon/common_source: back.h table.c src/games/backgammon/teachgammon: teach.c ttext2.c tutor.c Log Message: rename text() to wrtext(), aligning it with most other output routines, and avoiding a compile error on powerpc64. XXX: this tries to make a ".text" symbol, which already exists... To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/games/backgammon/backgammon/main.c cvs rdiff -u -r1.8 -r1.9 src/games/backgammon/backgammon/text.c cvs rdiff -u -r1.16 -r1.17 src/games/backgammon/common_source/back.h cvs rdiff -u -r1.10 -r1.11 src/games/backgammon/common_source/table.c cvs rdiff -u -r1.20 -r1.21 src/games/backgammon/teachgammon/teach.c cvs rdiff -u -r1.8 -r1.9 src/games/backgammon/teachgammon/ttext2.c \ src/games/backgammon/teachgammon/tutor.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/backgammon/backgammon/main.c diff -u src/games/backgammon/backgammon/main.c:1.27 src/games/backgammon/backgammon/main.c:1.28 --- src/games/backgammon/backgammon/main.c:1.27 Wed Aug 12 05:17:57 2009 +++ src/games/backgammon/backgammon/main.c Mon Mar 22 05:10:19 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.27 2009/08/12 05:17:57 dholland Exp $ */ +/* $NetBSD: main.c,v 1.28 2010/03/22 05:10:19 mrg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.27 2009/08/12 05:17:57 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.28 2010/03/22 05:10:19 mrg Exp $"); #endif #endif/* not lint */ @@ -133,15 +133,15 @@ /* check if restored game and save flag for later */ if ((rfl = rflag) != 0) { - text(message); /* print message */ - text(contin); + wrtext(message); /* print message */ + wrtext(contin); wrboard(); /* print board */ /* if new game, pretend to be a non-restored game */ if (cturn == 0) rflag = 0; } else { rscore = wscore = 0; /* zero score */ - text(message); /* update message without pausing */ + wrtext(message); /* update message without pausing */ if (aflag) { /* print rules */ writel(rules); @@ -158,7 +158,7 @@ writel(need); if (yorn(0)) { /* print instructions */ clear(); - text(instr); + wrtext(instr); } } } @@ -223,7 +223,7 @@ } else if (!aflag) /* pause to read message */ -text(contin); +wrtext(contin); wrboard(); /* print board */ @@ -416,7 +416,7 @@ curmove(20, 0); else writec('\n'); - text(helpm); + wrtext(helpm); if (tflag) curmove(cturn == -1 ? 18 : 19, 0); Index: src/games/backgammon/backgammon/text.c diff -u src/games/backgammon/backgammon/text.c:1.8 src/games/backgammon/backgammon/text.c:1.9 --- src/games/backgammon/backgammon/text.c:1.8 Fri Jul 1 01:12:39 2005 +++ src/games/backgammon/backgammon/text.c Mon Mar 22 05:10:19 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: text.c,v 1.8 2005/07/01 01:12:39 jmc Exp $ */ +/* $NetBSD: text.c,v 1.9 2010/03/22 05:10:19 mrg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)text.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: text.c,v 1.8 2005/07/01 01:12:39 jmc Exp $"); +__RCSID("$NetBSD: text.c,v 1.9 2010/03/22 05:10:19 mrg Exp $"); #endif #endif /* not lint */ @@ -107,7 +107,7 @@ 0}; int -text(const char *const *t) +wrtext(const char *const *t) { int i; const char *s, *a; Index: src/games/backgammon/common_source/back.h diff -u src/games/backgammon/common_source/back.h:1.16 src/games/backgammon/common_source/back.h:1.17 --- src/games/backgammon/common_source/back.h:1.16 Wed Aug 12 05:17:57 2009 +++ src/games/backgammon/common_source/back.h Mon Mar 22 05:10:19 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: back.h,v 1.16 2009/08/12 05:17:57 dholland Exp $ */ +/* $NetBSD: back.h,v 1.17 2010/03/22 05:10:19 mrg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -165,7 +165,7 @@ void refresh(void); void roll(void); void save(int); -int text(const char *const *); +int wrtext(const char *const *); void wrboard(void); void wrhit(int); void wrint(int); Index: src/games/backgammon/common_source/table.c diff -u src/games/backgammon/common_source/table.c:1.10 src/games/backgammon/common_source/table.c:1.11 --- src/games/backgammon/common_source/table.c:1.10 Wed Aug 12 05:17:57 2009 +++ src/games/backgammon/common_source/table.c Mon Mar 22 05:10:19 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: table.c,v 1.10 2009/08/12 05:17:57 dholland Exp $ */ +/* $NetBSD: table.c,v 1.11 2010/03/22 05:10:19 mrg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: table.c,v 1
CVS commit: src/games/backgammon
Module Name:src Committed By: dholland Date: Wed Aug 12 05:17:58 UTC 2009 Modified Files: src/games/backgammon/backgammon: backlocal.h extra.c main.c move.c src/games/backgammon/common_source: back.h board.c fancy.c one.c save.c subs.c table.c src/games/backgammon/teachgammon: data.c teach.c tutor.c tutor.h Log Message: sprinkle static To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/games/backgammon/backgammon/backlocal.h cvs rdiff -u -r1.6 -r1.7 src/games/backgammon/backgammon/extra.c cvs rdiff -u -r1.26 -r1.27 src/games/backgammon/backgammon/main.c cvs rdiff -u -r1.9 -r1.10 src/games/backgammon/backgammon/move.c cvs rdiff -u -r1.15 -r1.16 src/games/backgammon/common_source/back.h cvs rdiff -u -r1.8 -r1.9 src/games/backgammon/common_source/board.c cvs rdiff -u -r1.13 -r1.14 src/games/backgammon/common_source/fancy.c cvs rdiff -u -r1.6 -r1.7 src/games/backgammon/common_source/one.c cvs rdiff -u -r1.12 -r1.13 src/games/backgammon/common_source/save.c cvs rdiff -u -r1.16 -r1.17 src/games/backgammon/common_source/subs.c cvs rdiff -u -r1.9 -r1.10 src/games/backgammon/common_source/table.c cvs rdiff -u -r1.7 -r1.8 src/games/backgammon/teachgammon/data.c \ src/games/backgammon/teachgammon/tutor.c cvs rdiff -u -r1.19 -r1.20 src/games/backgammon/teachgammon/teach.c cvs rdiff -u -r1.8 -r1.9 src/games/backgammon/teachgammon/tutor.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/backgammon/backgammon/backlocal.h diff -u src/games/backgammon/backgammon/backlocal.h:1.3 src/games/backgammon/backgammon/backlocal.h:1.4 --- src/games/backgammon/backgammon/backlocal.h:1.3 Mon Apr 28 20:22:53 2008 +++ src/games/backgammon/backgammon/backlocal.h Wed Aug 12 05:17:57 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: backlocal.h,v 1.3 2008/04/28 20:22:53 martin Exp $ */ +/* $NetBSD: backlocal.h,v 1.4 2009/08/12 05:17:57 dholland Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,11 +31,6 @@ void dble(void); int dblgood(void); -int eval(void); int freemen(int); -void movcmp(void); void move(int); -int movegood(void); -void pickmove(void); int trapped(int, int); -void trymove(int, int); Index: src/games/backgammon/backgammon/extra.c diff -u src/games/backgammon/backgammon/extra.c:1.6 src/games/backgammon/backgammon/extra.c:1.7 --- src/games/backgammon/backgammon/extra.c:1.6 Fri Jul 1 01:12:39 2005 +++ src/games/backgammon/backgammon/extra.c Wed Aug 12 05:17:57 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: extra.c,v 1.6 2005/07/01 01:12:39 jmc Exp $ */ +/* $NetBSD: extra.c,v 1.7 2009/08/12 05:17:57 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)extra.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: extra.c,v 1.6 2005/07/01 01:12:39 jmc Exp $"); +__RCSID("$NetBSD: extra.c,v 1.7 2009/08/12 05:17:57 dholland Exp $"); #endif #endif /* not lint */ @@ -45,6 +45,8 @@ FILE *trace; #endif +static int eval(void); + /* * dble() * Have the current player double and ask opponent to accept. @@ -231,7 +233,7 @@ return (ct / 5); } -int +static int eval(void) { int i, j; Index: src/games/backgammon/backgammon/main.c diff -u src/games/backgammon/backgammon/main.c:1.26 src/games/backgammon/backgammon/main.c:1.27 --- src/games/backgammon/backgammon/main.c:1.26 Wed Aug 12 04:51:11 2009 +++ src/games/backgammon/backgammon/main.c Wed Aug 12 05:17:57 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.26 2009/08/12 04:51:11 dholland Exp $ */ +/* $NetBSD: main.c,v 1.27 2009/08/12 05:17:57 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.26 2009/08/12 04:51:11 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.27 2009/08/12 05:17:57 dholland Exp $"); #endif #endif/* not lint */ @@ -54,14 +54,14 @@ extern const char *const message[]; /* update message */ extern short ospeed; /* tty output speed */ -const char *const helpm[] = { /* help message */ +static const char *const helpm[] = { /* help message */ "Enter a space or newline to roll, or", " R to reprint the board\tD to double", " S to save the game\tQ to quit", 0 }; -const char *const contin[] = { /* pause message */ +static const char *const contin[] = { /* pause message */ "(Type a newline to continue.)", "", 0 Index: src/games/backgammon/backgammon/move.c diff -u src/games/backgammon/backgammon/move.c:1.9 src/games/backgammon/backgammon/move.c:1.10 --- src/games/backgammon/backgammon/move.c:1.9 Fri Jul 1 01:12:39 2005 +++ src/games/backgammon/backgammon/move.c Wed Aug 12 05:17:57 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: move.c,v 1.9 2005/07/01 01:12:39 jmc Exp $ */ +/* $NetBSD: move.c,v 1.10 2009/08/12 05:17:57 dholland Exp $ */ /* * Copyright (c) 1980,
CVS commit: src/games/backgammon
Module Name:src Committed By: dholland Date: Sat Oct 13 18:44:15 UTC 2012 Modified Files: src/games/backgammon/backgammon: main.c move.c src/games/backgammon/common_source: allow.c back.h check.c init.c one.c save.c subs.c table.c src/games/backgammon/teachgammon: tutor.c Log Message: Crack down on global variables with single-letter names. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/games/backgammon/backgammon/main.c cvs rdiff -u -r1.10 -r1.11 src/games/backgammon/backgammon/move.c cvs rdiff -u -r1.6 -r1.7 src/games/backgammon/common_source/allow.c \ src/games/backgammon/common_source/check.c cvs rdiff -u -r1.18 -r1.19 src/games/backgammon/common_source/back.h cvs rdiff -u -r1.8 -r1.9 src/games/backgammon/common_source/init.c cvs rdiff -u -r1.7 -r1.8 src/games/backgammon/common_source/one.c cvs rdiff -u -r1.14 -r1.15 src/games/backgammon/common_source/save.c cvs rdiff -u -r1.17 -r1.18 src/games/backgammon/common_source/subs.c cvs rdiff -u -r1.11 -r1.12 src/games/backgammon/common_source/table.c cvs rdiff -u -r1.9 -r1.10 src/games/backgammon/teachgammon/tutor.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/backgammon/backgammon/main.c diff -u src/games/backgammon/backgammon/main.c:1.28 src/games/backgammon/backgammon/main.c:1.29 --- src/games/backgammon/backgammon/main.c:1.28 Mon Mar 22 05:10:19 2010 +++ src/games/backgammon/backgammon/main.c Sat Oct 13 18:44:14 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.28 2010/03/22 05:10:19 mrg Exp $ */ +/* $NetBSD: main.c,v 1.29 2012/10/13 18:44:14 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.28 2010/03/22 05:10:19 mrg Exp $"); +__RCSID("$NetBSD: main.c,v 1.29 2012/10/13 18:44:14 dholland Exp $"); #endif #endif/* not lint */ @@ -94,6 +94,7 @@ main(int argc __unused, char **argv) int l; /* non-descript index */ charc; /* non-descript character storage */ time_t t; /* time for random num generator */ + struct move *mm = &gm; /* revoke setgid privileges */ setgid(getgid()); @@ -245,17 +246,17 @@ main(int argc __unused, char **argv) if (!rflag) { if (tflag) curmove(17, 0); - while (D0 == D1) /* no doubles */ + while (mm->D0 == mm->D1) /* no doubles */ roll(); /* print rolls */ writel(rollr); - writec(D0 + '0'); + writec(mm->D0 + '0'); writel(rollw); - writec(D1 + '0'); + writec(mm->D1 + '0'); /* winner goes first */ - if (D0 > D1) { + if (mm->D0 > mm->D1) { writel(rstart); cturn = 1; } else { @@ -292,7 +293,7 @@ main(int argc __unused, char **argv) if (cturn == pnum) /* computer's move */ move(0); else { /* player's move */ -mvlim = movallow(); +mm->mvlim = movallow(); /* reprint roll */ if (tflag) curmove(cturn == -1 ? 18 : 19, 0); @@ -380,13 +381,13 @@ main(int argc __unused, char **argv) case '\n': roll(); writel(" rolls "); - writec(D0 + '0'); + writec(mm->D0 + '0'); writec(' '); - writec(D1 + '0'); + writec(mm->D1 + '0'); writel(". "); /* see if he can move */ - if ((mvlim = movallow()) == 0) { + if ((mm->mvlim = movallow()) == 0) { /* can't move */ writel(toobad1); @@ -435,7 +436,7 @@ main(int argc __unused, char **argv) proll(); /* can he move? */ -if ((mvlim = movallow()) == 0) { +if ((mm->mvlim = movallow()) == 0) { /* he can't */ writel(toobad2); Index: src/games/backgammon/backgammon/move.c diff -u src/games/backgammon/backgammon/move.c:1.10 src/games/backgammon/backgammon/move.c:1.11 --- src/games/backgammon/backgammon/move.c:1.10 Wed Aug 12 05:17:57 2009 +++ src/games/backgammon/backgammon/move.c Sat Oct 13 18:44:14 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: move.c,v 1.10 2009/08/12 05:17:57 dholland Exp $ */ +/* $NetBSD: move.c,v 1.11 2012/10/13 18:44:14 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,10 +34,12 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: move.c,v 1.10 2009/08/12 05:17:57 dholland Exp $"); +__RCSID("$NetBSD: move.c,v 1.11 2012/10/13 18:44:14 dholland Exp $"); #endif #endif /* not lint */ +#include + #include "back.h" #include "backlocal.h" @@ -84,15 +86,15 @@ static int race; /* game reduced to a r static int bcomp(struct BOARD *, struct BOARD *); -static struct BOARD *bsave(void); -static void binsert(struct BOARD *); -static void boardcopy(struct BOARD *); +static struct BOARD *bsave(struct move *); +static void binsert(struct move *, struct BOARD *); +static void boardcopy(struct move *, struct BOARD *); static void makefree(struct BOARD *); -static void mvcheck(struct BOARD
CVS commit: src/games/backgammon
Module Name:src Committed By: dholland Date: Sat Oct 13 19:19:39 UTC 2012 Modified Files: src/games/backgammon/backgammon: backlocal.h main.c move.c src/games/backgammon/common_source: allow.c back.h check.c init.c one.c save.c subs.c table.c src/games/backgammon/teachgammon: teach.c tutor.c tutor.h Log Message: Pass the move info around instead of using it as a global. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/games/backgammon/backgammon/backlocal.h cvs rdiff -u -r1.29 -r1.30 src/games/backgammon/backgammon/main.c cvs rdiff -u -r1.11 -r1.12 src/games/backgammon/backgammon/move.c cvs rdiff -u -r1.7 -r1.8 src/games/backgammon/common_source/allow.c \ src/games/backgammon/common_source/check.c cvs rdiff -u -r1.19 -r1.20 src/games/backgammon/common_source/back.h cvs rdiff -u -r1.9 -r1.10 src/games/backgammon/common_source/init.c cvs rdiff -u -r1.8 -r1.9 src/games/backgammon/common_source/one.c cvs rdiff -u -r1.15 -r1.16 src/games/backgammon/common_source/save.c cvs rdiff -u -r1.18 -r1.19 src/games/backgammon/common_source/subs.c cvs rdiff -u -r1.12 -r1.13 src/games/backgammon/common_source/table.c cvs rdiff -u -r1.21 -r1.22 src/games/backgammon/teachgammon/teach.c cvs rdiff -u -r1.10 -r1.11 src/games/backgammon/teachgammon/tutor.c \ src/games/backgammon/teachgammon/tutor.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/backgammon/backgammon/backlocal.h diff -u src/games/backgammon/backgammon/backlocal.h:1.4 src/games/backgammon/backgammon/backlocal.h:1.5 --- src/games/backgammon/backgammon/backlocal.h:1.4 Wed Aug 12 05:17:57 2009 +++ src/games/backgammon/backgammon/backlocal.h Sat Oct 13 19:19:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: backlocal.h,v 1.4 2009/08/12 05:17:57 dholland Exp $ */ +/* $NetBSD: backlocal.h,v 1.5 2012/10/13 19:19:38 dholland Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -32,5 +32,5 @@ void dble(void); int dblgood(void); int freemen(int); -void move(int); +void move(struct move *, int); int trapped(int, int); Index: src/games/backgammon/backgammon/main.c diff -u src/games/backgammon/backgammon/main.c:1.29 src/games/backgammon/backgammon/main.c:1.30 --- src/games/backgammon/backgammon/main.c:1.29 Sat Oct 13 18:44:14 2012 +++ src/games/backgammon/backgammon/main.c Sat Oct 13 19:19:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.29 2012/10/13 18:44:14 dholland Exp $ */ +/* $NetBSD: main.c,v 1.30 2012/10/13 19:19:38 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.29 2012/10/13 18:44:14 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.30 2012/10/13 19:19:38 dholland Exp $"); #endif #endif/* not lint */ @@ -94,7 +94,7 @@ main(int argc __unused, char **argv) int l; /* non-descript index */ charc; /* non-descript character storage */ time_t t; /* time for random num generator */ - struct move *mm = &gm; + struct move mmstore, *mm; /* revoke setgid privileges */ setgid(getgid()); @@ -118,12 +118,15 @@ main(int argc __unused, char **argv) t = time(NULL); srandom(t); /* 'random' seed */ + /* need this now beceause getarg() may try to load a game */ + mm = &mmstore; + move_init(mm); #ifdef V7 while (*++argv != 0) /* process arguments */ #else while (*++argv != -1) /* process arguments */ #endif - getarg(&argv); + getarg(mm, &argv); args[acnt] = '\0'; if (tflag) { /* clear screen */ noech.c_oflag &= ~(ONLCR | OXTABS); @@ -240,14 +243,14 @@ main(int argc __unused, char **argv) for (;;) { /* begin game! */ /* initial roll if needed */ if ((!rflag) || raflag) - roll(); + roll(mm); /* perform ritual of first roll */ if (!rflag) { if (tflag) curmove(17, 0); while (mm->D0 == mm->D1) /* no doubles */ -roll(); +roll(mm); /* print rolls */ writel(rollr); @@ -291,14 +294,14 @@ main(int argc __unused, char **argv) /* do first move (special case) */ if (!(rflag && raflag)) { if (cturn == pnum) /* computer's move */ -move(0); +move(mm, 0); else { /* player's move */ -mm->mvlim = movallow(); +mm->mvlim = movallow(mm); /* reprint roll */ if (tflag) curmove(cturn == -1 ? 18 : 19, 0); -proll(); -getmove(); /* get player's move */ +proll(mm); +getmove(mm); /* get player's move */ } } if (tflag) { @@ -323,7 +326,7 @@ main(int argc __unused, char **argv) /* do computer's move */ if (cturn == pnum) { -move(1); +move(mm, 1); /* see if double refused */ if (cturn == -2 || cturn == 2) @@ -363,12 +366,12 @@ main(int argc __unused, char **argv) /* save game */ case 'S': raflag = 1; - save(1); + save(mm, 1); break
CVS commit: src/games/backgammon
Module Name:src Committed By: dholland Date: Sat Oct 13 19:25:22 UTC 2012 Modified Files: src/games/backgammon: Makefile.inc src/games/backgammon/backgammon: main.c src/games/backgammon/teachgammon: teach.c Log Message: Remove ifdefs for V7 (as opposed to older) unix. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/games/backgammon/Makefile.inc cvs rdiff -u -r1.30 -r1.31 src/games/backgammon/backgammon/main.c cvs rdiff -u -r1.22 -r1.23 src/games/backgammon/teachgammon/teach.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/backgammon/Makefile.inc diff -u src/games/backgammon/Makefile.inc:1.7 src/games/backgammon/Makefile.inc:1.8 --- src/games/backgammon/Makefile.inc:1.7 Wed Feb 3 15:34:38 2010 +++ src/games/backgammon/Makefile.inc Sat Oct 13 19:25:22 2012 @@ -1,9 +1,9 @@ -# $NetBSD: Makefile.inc,v 1.7 2010/02/03 15:34:38 roy Exp $ +# $NetBSD: Makefile.inc,v 1.8 2012/10/13 19:25:22 dholland Exp $ .include LIBCOMMON != cd ${.CURDIR}/../common_source; ${PRINTOBJDIR} -CPPFLAGS+=-DV7 -I${.CURDIR}/../common_source +CPPFLAGS+=-I${.CURDIR}/../common_source DPADD+= ${LIBCOMMON}/libcommon.a ${LIBTERMINFO} LDADD+= -L${LIBCOMMON} -lcommon -lterminfo Index: src/games/backgammon/backgammon/main.c diff -u src/games/backgammon/backgammon/main.c:1.30 src/games/backgammon/backgammon/main.c:1.31 --- src/games/backgammon/backgammon/main.c:1.30 Sat Oct 13 19:19:38 2012 +++ src/games/backgammon/backgammon/main.c Sat Oct 13 19:25:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.30 2012/10/13 19:19:38 dholland Exp $ */ +/* $NetBSD: main.c,v 1.31 2012/10/13 19:25:22 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.30 2012/10/13 19:19:38 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.31 2012/10/13 19:25:22 dholland Exp $"); #endif #endif/* not lint */ @@ -121,11 +121,7 @@ main(int argc __unused, char **argv) /* need this now beceause getarg() may try to load a game */ mm = &mmstore; move_init(mm); -#ifdef V7 while (*++argv != 0) /* process arguments */ -#else - while (*++argv != -1) /* process arguments */ -#endif getarg(mm, &argv); args[acnt] = '\0'; if (tflag) { /* clear screen */ Index: src/games/backgammon/teachgammon/teach.c diff -u src/games/backgammon/teachgammon/teach.c:1.22 src/games/backgammon/teachgammon/teach.c:1.23 --- src/games/backgammon/teachgammon/teach.c:1.22 Sat Oct 13 19:19:39 2012 +++ src/games/backgammon/teachgammon/teach.c Sat Oct 13 19:25:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: teach.c,v 1.22 2012/10/13 19:19:39 dholland Exp $ */ +/* $NetBSD: teach.c,v 1.23 2012/10/13 19:25:22 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: teach.c,v 1.22 2012/10/13 19:19:39 dholland Exp $"); +__RCSID("$NetBSD: teach.c,v 1.23 2012/10/13 19:25:22 dholland Exp $"); #endif #endif/* not lint */ @@ -81,11 +81,7 @@ main(int argc __unused, char *argv[]) /* need this now beceause getarg() may try to load a game */ mm = &mmstore; move_init(mm); -#ifdef V7 while (*++argv != 0) -#else - while (*++argv != -1) -#endif getarg(mm, &argv); if (tflag) { noech.c_oflag &= ~(ONLCR | OXTABS);
CVS commit: src/games/backgammon
Module Name:src Committed By: joerg Date: Fri Sep 13 20:46:50 UTC 2013 Modified Files: src/games/backgammon/common_source: subs.c src/games/backgammon/teachgammon: teach.c Log Message: GC descr and helpm. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/games/backgammon/common_source/subs.c cvs rdiff -u -r1.23 -r1.24 src/games/backgammon/teachgammon/teach.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/backgammon/common_source/subs.c diff -u src/games/backgammon/common_source/subs.c:1.19 src/games/backgammon/common_source/subs.c:1.20 --- src/games/backgammon/common_source/subs.c:1.19 Sat Oct 13 19:19:39 2012 +++ src/games/backgammon/common_source/subs.c Fri Sep 13 20:46:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: subs.c,v 1.19 2012/10/13 19:19:39 dholland Exp $ */ +/* $NetBSD: subs.c,v 1.20 2013/09/13 20:46:50 joerg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)subs.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: subs.c,v 1.19 2012/10/13 19:19:39 dholland Exp $"); +__RCSID("$NetBSD: subs.c,v 1.20 2013/09/13 20:46:50 joerg Exp $"); #endif #endif /* not lint */ @@ -47,19 +47,6 @@ static const char plred[] = "Player is r static const char plwhite[] = "Player is white, computer is red."; static const char nocomp[] = "(No computer play.)"; -static const char *const descr[] = { - "Usage: backgammon [-] [n r w b pr pw pb t3a]\n", - "\t-\tgets this list\n\tn\tdon't ask for rules or instructions", - "\tr\tplayer is red (implies n)\n\tw\tplayer is white (implies n)", - "\tb\ttwo players, red and white (implies n)", - "\tpr\tprint the board before red's turn", - "\tpw\tprint the board before white's turn", - "\tpb\tprint the board before both player's turn", - "\tterm\tterminal is a term", - "\tsfile\trecover saved game from file", - 0 -}; - void errexit(const char *s) { Index: src/games/backgammon/teachgammon/teach.c diff -u src/games/backgammon/teachgammon/teach.c:1.23 src/games/backgammon/teachgammon/teach.c:1.24 --- src/games/backgammon/teachgammon/teach.c:1.23 Sat Oct 13 19:25:22 2012 +++ src/games/backgammon/teachgammon/teach.c Fri Sep 13 20:46:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: teach.c,v 1.23 2012/10/13 19:25:22 dholland Exp $ */ +/* $NetBSD: teach.c,v 1.24 2013/09/13 20:46:50 joerg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,21 +39,13 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: teach.c,v 1.23 2012/10/13 19:25:22 dholland Exp $"); +__RCSID("$NetBSD: teach.c,v 1.24 2013/09/13 20:46:50 joerg Exp $"); #endif #endif/* not lint */ #include "back.h" #include "tutor.h" -static const char *const helpm[] = { - "\nEnter a space or newline to roll, or", - " b to display the board", - " d to double", - " q to quit\n", - 0 -}; - static const char *const contin[] = { "", 0
CVS commit: src/games/backgammon/common_source
Module Name:src Committed By: dholland Date: Sun Dec 6 11:41:47 UTC 2020 Modified Files: src/games/backgammon/common_source: back.h Log Message: speed limit 80 To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/games/backgammon/common_source/back.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/backgammon/common_source/back.h diff -u src/games/backgammon/common_source/back.h:1.21 src/games/backgammon/common_source/back.h:1.22 --- src/games/backgammon/common_source/back.h:1.21 Wed Apr 22 23:36:26 2020 +++ src/games/backgammon/common_source/back.h Sun Dec 6 11:41:47 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: back.h,v 1.21 2020/04/22 23:36:26 joerg Exp $ */ +/* $NetBSD: back.h,v 1.22 2020/12/06 11:41:47 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -46,7 +46,12 @@ #define rnum(r) (random()%r) #define D0 dice[0] #define D1 dice[1] -#define mswap(m) {(m)->D0 ^= (m)->D1; (m)->D1 ^= (m)->D0; (m)->D0 ^= (m)->D1; (m)->d0 = 1-(m)->d0;} +#define mswap(m) { \ + (m)->D0 ^= (m)->D1; \ + (m)->D1 ^= (m)->D0; \ + (m)->D0 ^= (m)->D1; \ + (m)->d0 = 1-(m)->d0; \ +} struct move { int dice[2]; /* value of dice */ @@ -121,7 +126,7 @@ extern char cin[100]; /* input line of c extern const char *const color[]; /* colors as strings */ extern const char *const *colorptr; /* color of current player */ -extern const char *const *Colorptr; /* color of current player, capitalized */ +extern const char *const *Colorptr; /* ditto, capitalized */ extern int colen; /* length of color of current player */ extern int buffnum;
CVS commit: src/games/backgammon/common_source
Module Name:src Committed By: mrg Date: Tue Apr 13 02:11:40 UTC 2021 Modified Files: src/games/backgammon/common_source: Makefile fancy.c Log Message: no longer need -Wno-error=implicit-fallthrough. don't provide common symbols that are in libterminfo now days. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/games/backgammon/common_source/Makefile cvs rdiff -u -r1.15 -r1.16 src/games/backgammon/common_source/fancy.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/backgammon/common_source/Makefile diff -u src/games/backgammon/common_source/Makefile:1.11 src/games/backgammon/common_source/Makefile:1.12 --- src/games/backgammon/common_source/Makefile:1.11 Sun Sep 29 23:44:59 2019 +++ src/games/backgammon/common_source/Makefile Tue Apr 13 02:11:39 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2019/09/29 23:44:59 mrg Exp $ +# $NetBSD: Makefile,v 1.12 2021/04/13 02:11:39 mrg Exp $ LIBISPRIVATE= yes @@ -6,11 +6,4 @@ LIB= common SRCS= allow.c board.c check.c fancy.c init.c odds.c \ one.c save.c subs.c table.c -.include - -# Has fallthru comment that is missed -.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc" -COPTS.check.c+= -Wno-error=implicit-fallthrough -.endif - .include Index: src/games/backgammon/common_source/fancy.c diff -u src/games/backgammon/common_source/fancy.c:1.15 src/games/backgammon/common_source/fancy.c:1.16 --- src/games/backgammon/common_source/fancy.c:1.15 Wed Apr 22 23:36:26 2020 +++ src/games/backgammon/common_source/fancy.c Tue Apr 13 02:11:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fancy.c,v 1.15 2020/04/22 23:36:26 joerg Exp $ */ +/* $NetBSD: fancy.c,v 1.16 2021/04/13 02:11:39 mrg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)fancy.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: fancy.c,v 1.15 2020/04/22 23:36:26 joerg Exp $"); +__RCSID("$NetBSD: fancy.c,v 1.16 2021/04/13 02:11:39 mrg Exp $"); #endif #endif /* not lint */ @@ -52,8 +52,10 @@ static void newline(void); * * XXX: rewrite this crap using curses. */ +#if 0 charPC; /* padding character */ char *BC; /* backspace sequence */ +#endif char *CD; /* clear to end of screen sequence */ char *CE; /* clear to end of line sequence */ char *CL; /* clear screen sequence */ @@ -62,7 +64,9 @@ char *HO; /* home cursor sequence */ char *MC; /* column cursor movement map */ char *ML; /* row cursor movement map */ char *ND; /* forward cursor sequence */ +#if 0 char *UP; /* up cursor sequence */ +#endif static int lHO; /* length of HO */ static int lBC; /* length of BC */
CVS commit: src/games/backgammon/backgammon
Module Name:src Committed By: dholland Date: Wed Aug 12 04:51:11 UTC 2009 Modified Files: src/games/backgammon/backgammon: main.c Log Message: looks as if "ospeed" here was meant to be extern. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/games/backgammon/backgammon/main.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/backgammon/backgammon/main.c diff -u src/games/backgammon/backgammon/main.c:1.25 src/games/backgammon/backgammon/main.c:1.26 --- src/games/backgammon/backgammon/main.c:1.25 Mon Jul 21 13:24:38 2008 +++ src/games/backgammon/backgammon/main.c Wed Aug 12 04:51:11 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.25 2008/07/21 13:24:38 lukem Exp $ */ +/* $NetBSD: main.c,v 1.26 2009/08/12 04:51:11 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.25 2008/07/21 13:24:38 lukem Exp $"); +__RCSID("$NetBSD: main.c,v 1.26 2009/08/12 04:51:11 dholland Exp $"); #endif #endif/* not lint */ @@ -52,7 +52,7 @@ extern const char *const instr[]; /* text of instructions */ extern const char *const message[]; /* update message */ -short ospeed; /* tty output speed */ +extern short ospeed; /* tty output speed */ const char *const helpm[] = { /* help message */ "Enter a space or newline to roll, or",
CVS commit: src/games/backgammon/backgammon
Module Name:src Committed By: dholland Date: Sat Oct 13 19:39:57 UTC 2012 Modified Files: src/games/backgammon/backgammon: move.c Log Message: Add strategic assertion, now passes -Wstrict-overflow. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/games/backgammon/backgammon/move.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/backgammon/backgammon/move.c diff -u src/games/backgammon/backgammon/move.c:1.12 src/games/backgammon/backgammon/move.c:1.13 --- src/games/backgammon/backgammon/move.c:1.12 Sat Oct 13 19:19:38 2012 +++ src/games/backgammon/backgammon/move.c Sat Oct 13 19:39:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: move.c,v 1.12 2012/10/13 19:19:38 dholland Exp $ */ +/* $NetBSD: move.c,v 1.13 2012/10/13 19:39:57 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: move.c,v 1.12 2012/10/13 19:19:38 dholland Exp $"); +__RCSID("$NetBSD: move.c,v 1.13 2012/10/13 19:39:57 dholland Exp $"); #endif #endif /* not lint */ @@ -167,6 +167,14 @@ move(struct move *mm, int okay) writec('-'); wrint(mm->g[i] = cg[i]); makmove(mm, i); + + /* + * This assertion persuades gcc 4.5 that the loop + * doesn't result in signed overflow of i. mvlim + * isn't, or at least shouldn't be, changed by makmove + * at all. + */ + assert(mm->mvlim >= 0 && mm->mvlim <= 5); } writec('.');
CVS commit: src/games/backgammon/backgammon
Module Name:src Committed By: dholland Date: Sat Mar 22 23:10:36 UTC 2014 Modified Files: src/games/backgammon/backgammon: main.c Log Message: don't declare ospeed; it's in To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/games/backgammon/backgammon/main.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/backgammon/backgammon/main.c diff -u src/games/backgammon/backgammon/main.c:1.31 src/games/backgammon/backgammon/main.c:1.32 --- src/games/backgammon/backgammon/main.c:1.31 Sat Oct 13 19:25:22 2012 +++ src/games/backgammon/backgammon/main.c Sat Mar 22 23:10:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.31 2012/10/13 19:25:22 dholland Exp $ */ +/* $NetBSD: main.c,v 1.32 2014/03/22 23:10:36 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.31 2012/10/13 19:25:22 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.32 2014/03/22 23:10:36 dholland Exp $"); #endif #endif/* not lint */ @@ -52,7 +52,6 @@ __RCSID("$NetBSD: main.c,v 1.31 2012/10/ extern const char *const instr[]; /* text of instructions */ extern const char *const message[]; /* update message */ -extern short ospeed; /* tty output speed */ static const char *const helpm[] = { /* help message */ "Enter a space or newline to roll, or",
CVS commit: src/games/backgammon/common_source
Module Name:src Committed By: joerg Date: Wed Apr 22 23:36:26 UTC 2020 Modified Files: src/games/backgammon/common_source: back.h fancy.c Log Message: buffnum is shared between subs.c and fancy.c To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/games/backgammon/common_source/back.h cvs rdiff -u -r1.14 -r1.15 src/games/backgammon/common_source/fancy.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/backgammon/common_source/back.h diff -u src/games/backgammon/common_source/back.h:1.20 src/games/backgammon/common_source/back.h:1.21 --- src/games/backgammon/common_source/back.h:1.20 Sat Oct 13 19:19:39 2012 +++ src/games/backgammon/common_source/back.h Wed Apr 22 23:36:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: back.h,v 1.20 2012/10/13 19:19:39 dholland Exp $ */ +/* $NetBSD: back.h,v 1.21 2020/04/22 23:36:26 joerg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -124,6 +124,8 @@ extern const char *const *colorptr; /* c extern const char *const *Colorptr; /* color of current player, capitalized */ extern int colen; /* length of color of current player */ +extern int buffnum; + extern struct termios old, noech, raw;/* original tty status */ extern int curr; /* row position of cursor */ Index: src/games/backgammon/common_source/fancy.c diff -u src/games/backgammon/common_source/fancy.c:1.14 src/games/backgammon/common_source/fancy.c:1.15 --- src/games/backgammon/common_source/fancy.c:1.14 Wed Aug 12 05:17:57 2009 +++ src/games/backgammon/common_source/fancy.c Wed Apr 22 23:36:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fancy.c,v 1.14 2009/08/12 05:17:57 dholland Exp $ */ +/* $NetBSD: fancy.c,v 1.15 2020/04/22 23:36:26 joerg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)fancy.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: fancy.c,v 1.14 2009/08/12 05:17:57 dholland Exp $"); +__RCSID("$NetBSD: fancy.c,v 1.15 2020/04/22 23:36:26 joerg Exp $"); #endif #endif /* not lint */ @@ -78,8 +78,6 @@ static char tcap[] = "bccdceclcmhomcmlnd /* corresponding strings */ static char **tstr[] = {&BC, &CD, &CE, &CL, &CM, &HO, &MC, &ML, &ND, &UP}; -int buffnum; /* pointer to output buffer */ - static char tbuf[1024]; /* buffer for decoded termcap entries */ static int oldb[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
CVS commit: src/games/backgammon/common_source
Module Name:src Committed By: christos Date: Mon Feb 18 19:35:44 UTC 2019 Modified Files: src/games/backgammon/common_source: check.c Log Message: add fallthrough To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/games/backgammon/common_source/check.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/backgammon/common_source/check.c diff -u src/games/backgammon/common_source/check.c:1.8 src/games/backgammon/common_source/check.c:1.9 --- src/games/backgammon/common_source/check.c:1.8 Sat Oct 13 15:19:39 2012 +++ src/games/backgammon/common_source/check.c Mon Feb 18 14:35:44 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: check.c,v 1.8 2012/10/13 19:19:39 dholland Exp $ */ +/* $NetBSD: check.c,v 1.9 2019/02/18 19:35:44 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)check.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: check.c,v 1.8 2012/10/13 19:19:39 dholland Exp $"); +__RCSID("$NetBSD: check.c,v 1.9 2019/02/18 19:35:44 christos Exp $"); #endif #endif /* not lint */ @@ -66,6 +66,7 @@ getmove(struct move *mm) bflag = pnum; return; } + /*FALLTHROUGH*/ case -4: case 0: if (tflag)