summaryrefslogtreecommitdiffstats
path: root/backgammon
diff options
context:
space:
mode:
authorjmc <jmc@NetBSD.org>2005-07-01 01:12:39 +0000
committerjmc <jmc@NetBSD.org>2005-07-01 01:12:39 +0000
commit78f2acb399b7ee114054076af75a876ea880d96f (patch)
treeea91c1be066483ad88b8f1dc70dd057a55d1f44b /backgammon
parent0272ab0970dca7cdbac5a1669e694d8e06ceaec7 (diff)
downloadbsdgames-darwin-78f2acb399b7ee114054076af75a876ea880d96f.tar.gz
bsdgames-darwin-78f2acb399b7ee114054076af75a876ea880d96f.tar.zst
bsdgames-darwin-78f2acb399b7ee114054076af75a876ea880d96f.zip
KNF and WARNS=3 fixes
Diffstat (limited to 'backgammon')
-rw-r--r--backgammon/backgammon/extra.c16
-rw-r--r--backgammon/backgammon/main.c11
-rw-r--r--backgammon/backgammon/move.c70
-rw-r--r--backgammon/backgammon/text.c7
-rw-r--r--backgammon/backgammon/version.c6
-rw-r--r--backgammon/common_source/allow.c6
-rw-r--r--backgammon/common_source/back.h8
-rw-r--r--backgammon/common_source/board.c8
-rw-r--r--backgammon/common_source/check.c9
-rw-r--r--backgammon/common_source/fancy.c131
-rw-r--r--backgammon/common_source/odds.c12
-rw-r--r--backgammon/common_source/one.c21
-rw-r--r--backgammon/common_source/save.c13
-rw-r--r--backgammon/common_source/subs.c52
-rw-r--r--backgammon/common_source/table.c13
-rw-r--r--backgammon/teachgammon/teach.c10
-rw-r--r--backgammon/teachgammon/ttext2.c7
-rw-r--r--backgammon/teachgammon/tutor.c14
18 files changed, 192 insertions, 222 deletions
diff --git a/backgammon/backgammon/extra.c b/backgammon/backgammon/extra.c
index a5b5faab..4b932568 100644
--- a/backgammon/backgammon/extra.c
+++ b/backgammon/backgammon/extra.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extra.c,v 1.5 2003/08/07 09:36:55 agc Exp $ */
+/* $NetBSD: extra.c,v 1.6 2005/07/01 01:12:39 jmc 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.5 2003/08/07 09:36:55 agc Exp $");
+__RCSID("$NetBSD: extra.c,v 1.6 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -51,7 +51,7 @@ FILE *trace;
*/
void
-dble()
+dble(void)
{
int resp; /* response to y/n */
@@ -113,7 +113,7 @@ dble()
*/
int
-dblgood()
+dblgood(void)
{
int n; /* accumulated judgment */
int OFFC = *offptr; /* no. of computer's men off */
@@ -188,8 +188,7 @@ dblgood()
}
int
-freemen(b)
- int b;
+freemen(int b)
{
int i, inc, lim;
@@ -207,8 +206,7 @@ freemen(b)
}
int
-trapped(n, inc)
- int n, inc;
+trapped(int n, int inc)
{
int i, j, k;
int c, l, ct;
@@ -234,7 +232,7 @@ trapped(n, inc)
}
int
-eval()
+eval(void)
{
int i, j;
diff --git a/backgammon/backgammon/main.c b/backgammon/backgammon/main.c
index 594fb09e..57c27874 100644
--- a/backgammon/backgammon/main.c
+++ b/backgammon/backgammon/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.21 2005/02/15 12:56:20 jsm Exp $ */
+/* $NetBSD: main.c,v 1.22 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: main.c,v 1.21 2005/02/15 12:56:20 jsm Exp $");
+__RCSID("$NetBSD: main.c,v 1.22 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -88,9 +88,7 @@ static const char password[] = "losfurng";
static char pbuf[10];
int
-main(argc, argv)
- int argc __attribute__((__unused__));
- char **argv;
+main(int argc __attribute__((__unused__)), char **argv)
{
int i; /* non-descript index */
int l; /* non-descript index */
@@ -420,7 +418,8 @@ main(argc, argv)
writec('\n');
text(helpm);
if (tflag)
- curmove(cturn == -1 ? 18 : 19, 0);
+ curmove(cturn == -1 ?
+ 18 : 19, 0);
else
writec('\n');
diff --git a/backgammon/backgammon/move.c b/backgammon/backgammon/move.c
index 81cc6450..2ee0a34f 100644
--- a/backgammon/backgammon/move.c
+++ b/backgammon/backgammon/move.c
@@ -1,4 +1,4 @@
-/* $NetBSD: move.c,v 1.8 2004/01/27 20:30:28 jsm Exp $ */
+/* $NetBSD: move.c,v 1.9 2005/07/01 01:12:39 jmc 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.8 2004/01/27 20:30:28 jsm Exp $");
+__RCSID("$NetBSD: move.c,v 1.9 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -92,9 +92,9 @@ static void mvcheck(struct BOARD *, struct BOARD *);
static struct BOARD *nextfree(void);
+/* zero if first move */
void
-move(okay)
- int okay; /* zero if first move */
+move(int okay)
{
int i; /* index */
int l; /* last man */
@@ -181,10 +181,10 @@ move(okay)
fixtty(&raw); /* no more tty interrupt */
}
+/* mvnum == number of move (rel zero) */
+/* swapped == see if swapped also tested */
void
-trymove(mvnum, swapped)
- int mvnum; /* number of move (rel zero) */
- int swapped; /* see if swapped also tested */
+trymove(int mvnum, int swapped)
{
int pos; /* position on board */
int rval; /* value of roll */
@@ -234,7 +234,7 @@ trymove(mvnum, swapped)
}
static struct BOARD *
-bsave()
+bsave(void)
{
int i; /* index */
struct BOARD *now; /* current position */
@@ -255,52 +255,50 @@ bsave()
return (now);
}
+/* new == item to insert */
static void
-binsert(new)
- struct BOARD *new; /* item to insert */
+binsert(struct BOARD *new)
{
- struct BOARD *p = checkq; /* queue pointer */
+ struct BOARD *qp = checkq; /* queue pointer */
int result; /* comparison result */
- if (p == 0) { /* check if queue empty */
- checkq = p = new;
- p->b_next = 0;
+ if (qp == 0) { /* check if queue empty */
+ checkq = qp = new;
+ qp->b_next = 0;
return;
}
- result = bcomp(new, p); /* compare to first element */
+ result = bcomp(new, qp); /* compare to first element */
if (result < 0) { /* insert in front */
- new->b_next = p;
+ new->b_next = qp;
checkq = new;
return;
}
if (result == 0) { /* duplicate entry */
- mvcheck(p, new);
+ mvcheck(qp, new);
makefree(new);
return;
}
- while (p->b_next != 0) {/* traverse queue */
- result = bcomp(new, p->b_next);
+ while (qp->b_next != 0) {/* traverse queue */
+ result = bcomp(new, qp->b_next);
if (result < 0) { /* found place */
- new->b_next = p->b_next;
- p->b_next = new;
+ new->b_next = qp->b_next;
+ qp->b_next = new;
return;
}
if (result == 0) { /* duplicate entry */
- mvcheck(p->b_next, new);
+ mvcheck(qp->b_next, new);
makefree(new);
return;
}
- p = p->b_next;
+ qp = qp->b_next;
}
/* place at end of queue */
- p->b_next = new;
+ qp->b_next = new;
new->b_next = 0;
}
static int
-bcomp(a, b)
- struct BOARD *a;
- struct BOARD *b;
+bcomp(struct BOARD *a, struct BOARD *b)
{
int *aloc = a->b_board; /* pointer to board a */
int *bloc = b->b_board; /* pointer to board b */
@@ -316,9 +314,7 @@ bcomp(a, b)
}
static void
-mvcheck(incumbent, candidate)
- struct BOARD *incumbent;
- struct BOARD *candidate;
+mvcheck(struct BOARD *incumbent, struct BOARD *candidate)
{
int i;
int result;
@@ -339,15 +335,14 @@ mvcheck(incumbent, candidate)
}
void
-makefree(dead)
- struct BOARD *dead; /* dead position */
+makefree(struct BOARD *dead)
{
dead->b_next = freeq; /* add to freeq */
freeq = dead;
}
static struct BOARD *
-nextfree()
+nextfree(void)
{
struct BOARD *new;
@@ -367,7 +362,7 @@ nextfree()
}
void
-pickmove()
+pickmove(void)
{
/* current game position */
struct BOARD *now = bsave();
@@ -391,8 +386,7 @@ pickmove()
}
static void
-boardcopy(s)
- struct BOARD *s; /* game situation */
+boardcopy(struct BOARD *s)
{
int i; /* index */
@@ -409,7 +403,7 @@ boardcopy(s)
}
void
-movcmp()
+movcmp(void)
{
int i;
@@ -483,7 +477,7 @@ movcmp()
}
int
-movegood()
+movegood(void)
{
int n;
diff --git a/backgammon/backgammon/text.c b/backgammon/backgammon/text.c
index e7f0064e..2f16baac 100644
--- a/backgammon/backgammon/text.c
+++ b/backgammon/backgammon/text.c
@@ -1,4 +1,4 @@
-/* $NetBSD: text.c,v 1.7 2003/08/07 09:36:56 agc Exp $ */
+/* $NetBSD: text.c,v 1.8 2005/07/01 01:12:39 jmc 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.7 2003/08/07 09:36:56 agc Exp $");
+__RCSID("$NetBSD: text.c,v 1.8 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -107,8 +107,7 @@ const char *const instr[] = {
0};
int
-text(t)
- const char *const *t;
+text(const char *const *t)
{
int i;
const char *s, *a;
diff --git a/backgammon/backgammon/version.c b/backgammon/backgammon/version.c
index 40a4e493..f57fefe5 100644
--- a/backgammon/backgammon/version.c
+++ b/backgammon/backgammon/version.c
@@ -1,4 +1,4 @@
-/* $NetBSD: version.c,v 1.6 2003/08/07 09:36:56 agc Exp $ */
+/* $NetBSD: version.c,v 1.7 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1987, 1993
@@ -34,11 +34,11 @@
#if 0
static char sccsid[] = "@(#)version.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: version.c,v 1.6 2003/08/07 09:36:56 agc Exp $");
+__RCSID("$NetBSD: version.c,v 1.7 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
-const char *const message[] = {
+const char *const message[] = {
"Last updated on Friday, October 10, 1997.",
0
};
diff --git a/backgammon/common_source/allow.c b/backgammon/common_source/allow.c
index f6bae784..04eaa4cd 100644
--- a/backgammon/common_source/allow.c
+++ b/backgammon/common_source/allow.c
@@ -1,4 +1,4 @@
-/* $NetBSD: allow.c,v 1.5 2003/08/07 09:36:56 agc Exp $ */
+/* $NetBSD: allow.c,v 1.6 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,14 +34,14 @@
#if 0
static char sccsid[] = "@(#)allow.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: allow.c,v 1.5 2003/08/07 09:36:56 agc Exp $");
+__RCSID("$NetBSD: allow.c,v 1.6 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
#include "back.h"
int
-movallow()
+movallow(void)
{
int i, m, iold;
int r;
diff --git a/backgammon/common_source/back.h b/backgammon/common_source/back.h
index 468d0e0b..557cfc6b 100644
--- a/backgammon/common_source/back.h
+++ b/backgammon/common_source/back.h
@@ -1,4 +1,4 @@
-/* $NetBSD: back.h,v 1.14 2004/01/27 20:30:28 jsm Exp $ */
+/* $NetBSD: back.h,v 1.15 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -141,7 +141,7 @@ void clend(void);
void cline(void);
int count(void);
void curmove(int, int);
-int dotable(char, int);
+int dotable(int, int);
void errexit(const char *) __attribute__((__noreturn__));
void fancyc(int);
void fboard(void);
@@ -179,7 +179,7 @@ void wrboard(void);
void wrbsub(void);
void wrhit(int);
void wrint(int);
-void writec(char);
+void writec(int);
void writel(const char *);
void wrscore(void);
-int yorn(char);
+int yorn(int);
diff --git a/backgammon/common_source/board.c b/backgammon/common_source/board.c
index f7eaa1bf..1c76eddb 100644
--- a/backgammon/common_source/board.c
+++ b/backgammon/common_source/board.c
@@ -1,4 +1,4 @@
-/* $NetBSD: board.c,v 1.7 2003/08/07 09:36:57 agc Exp $ */
+/* $NetBSD: board.c,v 1.8 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)board.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: board.c,v 1.7 2003/08/07 09:36:57 agc Exp $");
+__RCSID("$NetBSD: board.c,v 1.8 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -44,7 +44,7 @@ static int i, j, k;
static char ln[60];
void
-wrboard()
+wrboard(void)
{
int l;
static const char bl[] =
@@ -161,7 +161,7 @@ lastline:
}
void
-wrbsub()
+wrbsub(void)
{
int m;
char d;
diff --git a/backgammon/common_source/check.c b/backgammon/common_source/check.c
index 04ce1dba..185583e1 100644
--- a/backgammon/common_source/check.c
+++ b/backgammon/common_source/check.c
@@ -1,4 +1,4 @@
-/* $NetBSD: check.c,v 1.5 2003/08/07 09:36:57 agc Exp $ */
+/* $NetBSD: check.c,v 1.6 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,14 +34,14 @@
#if 0
static char sccsid[] = "@(#)check.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: check.c,v 1.5 2003/08/07 09:36:57 agc Exp $");
+__RCSID("$NetBSD: check.c,v 1.6 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
#include "back.h"
void
-getmove()
+getmove(void)
{
int i, c;
@@ -105,8 +105,7 @@ getmove()
}
int
-movokay(mv)
- int mv;
+movokay(int mv)
{
int i, m;
diff --git a/backgammon/common_source/fancy.c b/backgammon/common_source/fancy.c
index d38bc4ea..fcbeabb4 100644
--- a/backgammon/common_source/fancy.c
+++ b/backgammon/common_source/fancy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fancy.c,v 1.12 2004/04/23 02:58:27 simonb Exp $ */
+/* $NetBSD: fancy.c,v 1.13 2005/07/01 01:12:39 jmc 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.12 2004/04/23 02:58:27 simonb Exp $");
+__RCSID("$NetBSD: fancy.c,v 1.13 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -70,7 +70,8 @@ int buffnum; /* pointer to output buffer */
char tbuf[1024]; /* buffer for decoded termcap entries */
-int oldb[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+int oldb[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
int oldr;
int oldw;
@@ -80,7 +81,7 @@ int realr;
int realc;
void
-fboard()
+fboard(void)
{
int i, j, l;
@@ -187,11 +188,7 @@ fboard()
* differently.
*/
void
-bsect(b, rpos, cpos, cnext)
- int b; /* contents of position */
- int rpos; /* row of position */
- int cpos; /* column of position */
- int cnext; /* direction of position */
+bsect(int b, int rpos, int cpos, int cnext)
{
int j; /* index */
int n; /* number of men on position */
@@ -240,13 +237,14 @@ bsect(b, rpos, cpos, cnext)
bct = 3;
}
}
- curmove(curr + cnext, curc - bct); /* reposition cursor */
+ /* reposition cursor */
+ curmove(curr + cnext, curc - bct);
}
}
}
void
-refresh()
+refresh(void)
{
int i, r, c;
@@ -297,18 +295,17 @@ refresh()
}
void
-fixpos(old, new, r, c, inc)
- int old, new, r, c, inc;
+fixpos(int cur, int new, int r, int c, int inc)
{
int o, n, nv;
int ov, nc;
char col;
nc = 0;
- if (old * new >= 0) {
- ov = abs(old);
+ if (cur * new >= 0) {
+ ov = abs(cur);
nv = abs(new);
- col = (old + new > 0 ? 'r' : 'w');
+ col = (cur + new > 0 ? 'r' : 'w');
o = (ov - 1) / 5;
n = (nv - 1) / 5;
if (o == n) {
@@ -319,23 +316,29 @@ fixpos(old, new, r, c, inc)
if (o == 0)
nc = c < 54 ? c + 1 : c;
if (ov > nv)
- fixcol(r + inc * (nv - n * 5), nc, abs(ov - nv), ' ', inc);
+ fixcol(r + inc * (nv - n * 5), nc,
+ abs(ov - nv), ' ', inc);
else
- fixcol(r + inc * (ov - o * 5), nc, abs(ov - nv), col, inc);
+ fixcol(r + inc * (ov - o * 5), nc,
+ abs(ov - nv), col, inc);
return;
} else {
if (c < 54) {
if (o + n == 1) {
if (n) {
- fixcol(r, c, abs(nv - 5), col, inc);
+ fixcol(r, c, abs(nv - 5), col,
+ inc);
if (ov != 5)
- fixcol(r + inc * ov, c + 1,
- abs(ov - 5), col, inc);
+ fixcol(r + inc * ov,
+ c + 1, abs(ov - 5),
+ col, inc);
} else {
- fixcol(r, c, abs(ov - 5), ' ', inc);
+ fixcol(r, c, abs(ov - 5), ' ',
+ inc);
if (nv != 5)
- fixcol(r + inc * nv, c + 1,
- abs(nv - 5), ' ', inc);
+ fixcol(r + inc * nv,
+ c + 1, abs(nv - 5),
+ ' ', inc);
}
return;
}
@@ -343,37 +346,42 @@ fixpos(old, new, r, c, inc)
if (ov != 10)
fixcol(r + inc * (ov - 5), c,
abs(ov - 10), col, inc);
- fixcol(r, c + 2, abs(nv - 10), col, inc);
+ fixcol(r, c + 2, abs(nv - 10), col,
+ inc);
} else {
if (nv != 10)
fixcol(r + inc * (nv - 5), c,
abs(nv - 10), ' ', inc);
- fixcol(r, c + 2, abs(ov - 10), ' ', inc);
+ fixcol(r, c + 2, abs(ov - 10), ' ',
+ inc);
}
return;
}
if (n > o) {
- fixcol(r + inc * (ov % 5), c + o, abs(5 * n - ov), col, inc);
+ fixcol(r + inc * (ov % 5), c + o,
+ abs(5 * n - ov), col, inc);
if (nv != 5 * n)
- fixcol(r, c + n, abs(5 * n - nv), col, inc);
+ fixcol(r, c + n, abs(5 * n - nv),
+ col, inc);
} else {
- fixcol(r + inc * (nv % 5), c + n, abs(5 * n - nv), ' ', inc);
+ fixcol(r + inc * (nv % 5), c + n,
+ abs(5 * n - nv), ' ', inc);
if (ov != 5 * o)
- fixcol(r, c + o, abs(5 * o - ov), ' ', inc);
+ fixcol(r, c + o, abs(5 * o - ov),
+ ' ', inc);
}
return;
}
}
nv = abs(new);
fixcol(r, c + 1, nv, new > 0 ? 'r' : 'w', inc);
- if (abs(old) <= abs(new))
+ if (abs(cur) <= abs(new))
return;
- fixcol(r + inc * new, c + 1, abs(old + new), ' ', inc);
+ fixcol(r + inc * new, c + 1, abs(cur + new), ' ', inc);
}
void
-fixcol(r, c, l, ch, inc)
- int l, ch, r, c, inc;
+fixcol(int r, int c, int l, int ch, int inc)
{
int i;
@@ -386,8 +394,7 @@ fixcol(r, c, l, ch, inc)
}
void
-curmove(r, c)
- int r, c;
+curmove(int r, int c)
{
if (curr == r && curc == c)
return;
@@ -400,13 +407,13 @@ curmove(r, c)
}
void
-newpos()
+newpos(void)
{
int r; /* destination row */
int c; /* destination column */
int mode = -1; /* mode of movement */
- int count = 1000; /* character count */
+ int ccount = 1000; /* character count */
int i; /* index */
int n; /* temporary variable */
char *m; /* string containing CM movement */
@@ -429,51 +436,53 @@ newpos()
if (CM) { /* try CM to get there */
mode = 0;
m = (char *) tgoto(CM, c, r);
- count = strlen(m);
+ ccount = strlen(m);
}
/* try HO and local movement */
- if (HO && (n = r + c * lND + lHO) < count) {
+ if (HO && (n = r + c * lND + lHO) < ccount) {
mode = 1;
- count = n;
+ ccount = n;
}
/* try various LF combinations */
if (r >= curr) {
/* CR, LF, and ND */
- if ((n = (r - curr) + c * lND + 1) < count) {
+ if ((n = (r - curr) + c * lND + 1) < ccount) {
mode = 2;
- count = n;
+ ccount = n;
}
/* LF, ND */
- if (c >= curc && (n = (r - curr) + (c - curc) * lND) < count) {
+ if (c >= curc && (n = (r - curr) + (c - curc) * lND) < ccount) {
mode = 3;
- count = n;
+ ccount = n;
}
/* LF, BS */
- if (c < curc && (n = (r - curr) + (curc - c) * lBC) < count) {
+ if (c < curc && (n = (r - curr) + (curc - c) * lBC) < ccount) {
mode = 4;
- count = n;
+ ccount = n;
}
}
/* try corresponding UP combinations */
if (r < curr) {
/* CR, UP, and ND */
- if ((n = (curr - r) * lUP + c * lND + 1) < count) {
+ if ((n = (curr - r) * lUP + c * lND + 1) < ccount) {
mode = 5;
- count = n;
+ ccount = n;
}
/* UP and ND */
- if (c >= curc && (n = (curr - r) * lUP + (c - curc) * lND) < count) {
+ if (c >= curc &&
+ (n = (curr - r) * lUP + (c - curc) * lND) < ccount) {
mode = 6;
- count = n;
+ ccount = n;
}
/* UP and BS */
- if (c < curc && (n = (curr - r) * lUP + (curc - c) * lBC) < count) {
+ if (c < curc &&
+ (n = (curr - r) * lUP + (curc - c) * lBC) < ccount) {
mode = 7;
- count = n;
+ ccount = n;
}
}
/* space over */
- if (curr == r && c > curc && linect[r] < curc && c - curc < count)
+ if (curr == r && c > curc && linect[r] < curc && c - curc < ccount)
mode = 8;
switch (mode) {
@@ -564,7 +573,7 @@ newpos()
}
void
-clear()
+clear(void)
{
int i;
@@ -582,8 +591,7 @@ clear()
}
void
-fancyc(c)
- char c; /* character to output */
+fancyc(int c)
{
int sp; /* counts spaces in a tab */
@@ -633,7 +641,7 @@ fancyc(c)
}
void
-clend()
+clend(void)
{
int i;
@@ -654,7 +662,7 @@ clend()
}
void
-cline()
+cline(void)
{
int c;
@@ -676,7 +684,7 @@ cline()
}
void
-newline()
+newline(void)
{
cline();
if (curr == LI - 1)
@@ -686,8 +694,7 @@ newline()
}
int
-getcaps(s)
- const char *s;
+getcaps(const char *s)
{
char *code; /* two letter code */
char ***cap; /* pointer to cap string */
diff --git a/backgammon/common_source/odds.c b/backgammon/common_source/odds.c
index 509d5f49..0d875848 100644
--- a/backgammon/common_source/odds.c
+++ b/backgammon/common_source/odds.c
@@ -1,4 +1,4 @@
-/* $NetBSD: odds.c,v 1.5 2003/08/07 09:36:57 agc Exp $ */
+/* $NetBSD: odds.c,v 1.6 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,15 +34,14 @@
#if 0
static char sccsid[] = "@(#)odds.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: odds.c,v 1.5 2003/08/07 09:36:57 agc Exp $");
+__RCSID("$NetBSD: odds.c,v 1.6 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
#include "back.h"
void
-odds(r1, r2, val)
- int r1, r2, val;
+odds(int r1, int r2, int val)
{
int i, j;
@@ -66,7 +65,7 @@ odds(r1, r2, val)
}
int
-count()
+count(void)
{
int i;
int j;
@@ -80,8 +79,7 @@ count()
}
int
-canhit(i, c)
- int i, c;
+canhit(int i, int c)
{
int j, k, b;
int a, diff, place, addon, menstuck;
diff --git a/backgammon/common_source/one.c b/backgammon/common_source/one.c
index 86b57ef6..dde3096a 100644
--- a/backgammon/common_source/one.c
+++ b/backgammon/common_source/one.c
@@ -1,4 +1,4 @@
-/* $NetBSD: one.c,v 1.5 2003/08/07 09:36:57 agc Exp $ */
+/* $NetBSD: one.c,v 1.6 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,15 +34,14 @@
#if 0
static char sccsid[] = "@(#)one.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: one.c,v 1.5 2003/08/07 09:36:57 agc Exp $");
+__RCSID("$NetBSD: one.c,v 1.6 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
#include "back.h"
int
-makmove(i)
- int i;
+makmove(int i)
{
int n, d;
int max;
@@ -95,8 +94,7 @@ makmove(i)
}
void
-moverr(i)
- int i;
+moverr(int i)
{
int j;
@@ -118,8 +116,7 @@ moverr(i)
int
-checkd(d)
- int d;
+checkd(int d)
{
if (d0 != d)
swap;
@@ -127,7 +124,7 @@ checkd(d)
}
int
-last()
+last(void)
{
int i;
@@ -138,8 +135,7 @@ last()
}
void
-movback(i)
- int i;
+movback(int i)
{
int j;
@@ -148,8 +144,7 @@ movback(i)
}
void
-backone(i)
- int i;
+backone(int i)
{
board[p[i]] += cturn;
if (g[i] != home) {
diff --git a/backgammon/common_source/save.c b/backgammon/common_source/save.c
index e48a914f..d0c58715 100644
--- a/backgammon/common_source/save.c
+++ b/backgammon/common_source/save.c
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.10 2003/08/07 09:36:57 agc Exp $ */
+/* $NetBSD: save.c,v 1.11 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: save.c,v 1.10 2003/08/07 09:36:57 agc Exp $");
+__RCSID("$NetBSD: save.c,v 1.11 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -54,8 +54,7 @@ static const char rec[] = "\" to recover your game.\n\n";
static const char cantrec[] = "Can't recover file: ";
void
-save(n)
- int n;
+save(int n)
{
int fdesc;
char *fs;
@@ -145,8 +144,7 @@ save(n)
}
void
-recover(s)
- const char *s;
+recover(const char *s)
{
int fdesc;
@@ -168,8 +166,7 @@ recover(s)
}
void
-norec(s)
- const char *s;
+norec(const char *s)
{
const char *c;
diff --git a/backgammon/common_source/subs.c b/backgammon/common_source/subs.c
index 1daeb72e..a95e4813 100644
--- a/backgammon/common_source/subs.c
+++ b/backgammon/common_source/subs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: subs.c,v 1.14 2003/08/07 09:36:57 agc Exp $ */
+/* $NetBSD: subs.c,v 1.15 2005/07/01 01:12:39 jmc 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.14 2003/08/07 09:36:57 agc Exp $");
+__RCSID("$NetBSD: subs.c,v 1.15 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -61,8 +61,7 @@ const char *const descr[] = {
};
void
-errexit(s)
- const char *s;
+errexit(const char *s)
{
write(2, "\n", 1);
perror(s);
@@ -70,8 +69,7 @@ errexit(s)
}
int
-addbuf(c)
- int c;
+addbuf(int c)
{
buffnum++;
if (buffnum == BUFSIZ) {
@@ -84,7 +82,7 @@ addbuf(c)
}
void
-buflush()
+buflush(void)
{
if (buffnum < 0)
return;
@@ -95,7 +93,7 @@ buflush()
}
int
-readc()
+readc(void)
{
char c;
@@ -122,8 +120,7 @@ readc()
}
void
-writec(c)
- char c;
+writec(int c)
{
if (tflag)
fancyc(c);
@@ -132,8 +129,7 @@ writec(c)
}
void
-writel(l)
- const char *l;
+writel(const char *l)
{
#ifdef DEBUG
const char *s;
@@ -157,7 +153,7 @@ writel(l)
}
void
-proll()
+proll(void)
{
if (d0)
swap;
@@ -173,8 +169,7 @@ proll()
}
void
-wrint(n)
- int n;
+wrint(int n)
{
int i, j, t;
@@ -189,7 +184,7 @@ wrint(n)
}
void
-gwrite()
+gwrite(void)
{
int r, c;
@@ -232,7 +227,7 @@ gwrite()
}
int
-quit()
+quit(void)
{
if (tflag) {
@@ -254,8 +249,7 @@ quit()
}
int
-yorn(special)
- char special; /* special response */
+yorn(int special)
{
char c;
int i;
@@ -285,8 +279,7 @@ yorn(special)
}
void
-wrhit(i)
- int i;
+wrhit(int i)
{
writel("Blot hit on ");
wrint(i);
@@ -295,7 +288,7 @@ wrhit(i)
}
void
-nexturn()
+nexturn(void)
{
int c;
@@ -312,8 +305,7 @@ nexturn()
}
void
-getarg(arg)
- char ***arg;
+getarg(char ***arg)
{
char **s;
@@ -399,7 +391,7 @@ getarg(arg)
}
void
-init()
+init(void)
{
int i;
@@ -418,7 +410,7 @@ init()
}
void
-wrscore()
+wrscore(void)
{
writel("Score: ");
writel(color[1]);
@@ -431,8 +423,7 @@ wrscore()
}
void
-fixtty(t)
- struct termios *t;
+fixtty(struct termios *t)
{
if (tflag)
newpos();
@@ -442,8 +433,7 @@ fixtty(t)
}
void
-getout(dummy)
- int dummy __attribute__((__unused__));
+getout(int dummy __attribute__((__unused__)))
{
/* go to bottom of screen */
if (tflag) {
@@ -458,7 +448,7 @@ getout(dummy)
}
void
-roll()
+roll(void)
{
char c;
int row;
diff --git a/backgammon/common_source/table.c b/backgammon/common_source/table.c
index e54e8010..280fe87c 100644
--- a/backgammon/common_source/table.c
+++ b/backgammon/common_source/table.c
@@ -1,4 +1,4 @@
-/* $NetBSD: table.c,v 1.7 2003/08/07 09:36:57 agc Exp $ */
+/* $NetBSD: table.c,v 1.8 2005/07/01 01:12:39 jmc 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.7 2003/08/07 09:36:57 agc Exp $");
+__RCSID("$NetBSD: table.c,v 1.8 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -78,8 +78,7 @@ static const struct state atmata[] = {
};
int
-checkmove(ist)
- int ist;
+checkmove(int ist)
{
int j, n;
char c;
@@ -196,9 +195,7 @@ dochar:
}
int
-dotable(c, i)
- char c;
- int i;
+dotable(int c, int i)
{
int a;
int test;
@@ -292,7 +289,7 @@ dotable(c, i)
}
int
-rsetbrd()
+rsetbrd(void)
{
int i, j, n;
diff --git a/backgammon/teachgammon/teach.c b/backgammon/teachgammon/teach.c
index 7619c3c1..8f197176 100644
--- a/backgammon/teachgammon/teach.c
+++ b/backgammon/teachgammon/teach.c
@@ -1,4 +1,4 @@
-/* $NetBSD: teach.c,v 1.16 2005/02/15 12:56:20 jsm Exp $ */
+/* $NetBSD: teach.c,v 1.17 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: teach.c,v 1.16 2005/02/15 12:56:20 jsm Exp $");
+__RCSID("$NetBSD: teach.c,v 1.17 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -60,9 +60,7 @@ const char *const contin[] = {
};
int
-main(argc, argv)
- int argc __attribute__((__unused__));
- char *argv[];
+main(int argc __attribute__((__unused__)), char *argv[])
{
int i;
@@ -145,7 +143,7 @@ main(argc, argv)
}
void
-leave()
+leave(void)
{
if (tflag)
clear();
diff --git a/backgammon/teachgammon/ttext2.c b/backgammon/teachgammon/ttext2.c
index 455015df..99e3b49c 100644
--- a/backgammon/teachgammon/ttext2.c
+++ b/backgammon/teachgammon/ttext2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ttext2.c,v 1.7 2003/08/07 09:36:58 agc Exp $ */
+/* $NetBSD: ttext2.c,v 1.8 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)ttext2.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: ttext2.c,v 1.7 2003/08/07 09:36:58 agc Exp $");
+__RCSID("$NetBSD: ttext2.c,v 1.8 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
@@ -127,8 +127,7 @@ const char *const lastch[] = {
int
-text(txt)
- const char *const *txt;
+text(const char *const *txt)
{
const char *const *begin;
const char *a;
diff --git a/backgammon/teachgammon/tutor.c b/backgammon/teachgammon/tutor.c
index 4516902a..0af7100e 100644
--- a/backgammon/teachgammon/tutor.c
+++ b/backgammon/teachgammon/tutor.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tutor.c,v 1.6 2003/08/07 09:36:58 agc Exp $ */
+/* $NetBSD: tutor.c,v 1.7 2005/07/01 01:12:39 jmc Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,17 +34,18 @@
#if 0
static char sccsid[] = "@(#)tutor.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: tutor.c,v 1.6 2003/08/07 09:36:58 agc Exp $");
+__RCSID("$NetBSD: tutor.c,v 1.7 2005/07/01 01:12:39 jmc Exp $");
#endif
#endif /* not lint */
#include "back.h"
#include "tutor.h"
-static const char better[] = "That is a legal move, but there is a better one.\n";
+static const char better[] =
+ "That is a legal move, but there is a better one.\n";
void
-tutor()
+tutor(void)
{
int i, j;
@@ -129,7 +130,7 @@ tutor()
}
void
-clrest()
+clrest(void)
{
int r, c, j;
@@ -143,8 +144,7 @@ clrest()
}
int
-brdeq(b1, b2)
- const int *b1, *b2;
+brdeq(const int *b1, const int *b2)
{
const int *e;