DragonFly BSD
DragonFly submit List (threaded) for 2005-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[PATCH] games/backgammon WARNS6


From: Peter Avalos <pavalos@xxxxxxxxxxxx>
Date: Sun, 31 Jul 2005 06:42:45 -0700

Here's a patch that brings games/backgammon up to WARNS6.

http://www.theshell.com/~pavalos/wip/backgammon.diff

--Peter
Index: games/backgammon/backgammon/Makefile
===================================================================
RCS file: /home/dcvs/src/games/backgammon/backgammon/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- games/backgammon/backgammon/Makefile	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/backgammon/Makefile	31 Jul 2005 10:03:12 -0000
@@ -7,10 +7,11 @@
 SRCS=	allow.c board.c check.c extra.c fancy.c init.c main.c move.c \
 	odds.c one.c save.c subs.c table.c text.c version.c
 MAN=	backgammon.6
-DPADD=	${LIBTERMCAP} ${LIBCOMPAT}
-LDADD=	-ltermcap -lcompat
+DPADD=	${LIBTERMCAP}
+LDADD=	-ltermcap
 .PATH:	${.CURDIR}/../common_source
 HIDEGAME=hidegame
+WARNS?=	6
 
 .include "../../Makefile.inc"
 .include <bsd.prog.mk>
Index: games/backgammon/backgammon/extra.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/backgammon/extra.c,v
retrieving revision 1.2
diff -u -r1.2 extra.c
--- games/backgammon/backgammon/extra.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/backgammon/extra.c	31 Jul 2005 10:03:12 -0000
@@ -42,12 +42,16 @@
 FILE	*trace;
 #endif
 
+static int	eval(void);
+
 /*
  * dble()
  *	Have the current player double and ask opponent to accept.
  */
 
-dble ()  {
+void
+dble(void)
+{
 	int	resp;			/* response to y/n */
 
 	for (;;)  {
@@ -100,7 +104,7 @@
 		return;
 	}
 }
-
+
 /*
  * dblgood ()
  *	Returns 1 if the computer would double in this position.  This
@@ -112,7 +116,9 @@
  * behind.
  */
 
-dblgood ()  {
+int
+dblgood(void)
+{
 	int	n;			/* accumulated judgment */
 	int	OFFC = *offptr;		/* no. of computer's men off */
 	int	OFFO = *offopp;		/* no. of player's men off */
@@ -186,10 +192,9 @@
 		return(1);
 	return (0);
 }
-
-freemen (b)
-int	b;
 
+int
+freemen(int b)
 {
 	int		i, inc, lim;
 
@@ -205,10 +210,9 @@
 		return ((36-count())/5);
 	return (count()/5);
 }
-
-trapped (n,inc)
-int	n, inc;
 
+int
+trapped(int n, int inc)
 {
 	int		i, j, k;
 	int		c, l, ct;
@@ -232,9 +236,10 @@
 	}
 	return (ct/5);
 }
-
-eval ()  {
 
+static int
+eval(void)
+{
 	int		i, j;
 
 	for (j = i = 0; i < 26; i++)
Index: games/backgammon/backgammon/main.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/backgammon/main.c,v
retrieving revision 1.2
diff -u -r1.2 main.c
--- games/backgammon/backgammon/main.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/backgammon/main.c	31 Jul 2005 10:03:12 -0000
@@ -37,9 +37,7 @@
  */
 
 #include <stdio.h>
-#include <unistd.h>
 #include <string.h>
-#include <stdlib.h>
 #include <signal.h>
 #include "back.h"
 
@@ -84,10 +82,8 @@
 static const char	password[] = "losfurng";
 static char	pbuf[10];
 
-main (argc,argv)
-int	argc;
-char	**argv;
-
+int
+main(int argc, char **argv)
 {
 	int	i;		/* non-descript index */
 	int	l;		/* non-descript index */
@@ -99,8 +95,8 @@
 	/* initialization */
 	bflag = 2;					/* default no board */
 	acnt = 1;                                       /* Nuber of args */
-	signal (SIGINT,getout);				/* trap interrupts */
-	if (gtty (0,&tty) == -1)			/* get old tty mode */
+	signal (SIGINT,(sig_t)getout);			/* trap interrupts */
+	if (ioctl(0, TIOCGETP, &tty) == -1)		/* get old tty mode */
 		errexit ("backgammon(gtty)");
 	old = tty.sg_flags;
 #ifdef V7
@@ -133,7 +129,7 @@
 							/* check if restored
 							 * game and save flag
 							 * for later */
-	if (rfl = rflag)  {
+	if ((rfl = rflag) != 0)  {
 		text (message);				/* print message */
 		text (contin);
 		wrboard();				/* print board */
@@ -200,7 +196,7 @@
 					else
 						writec ('\n');
 					writel ("Password:");
-					signal (SIGALRM,getout);
+					signal (SIGALRM,(sig_t)getout);
 					cflag = 1;
 					alarm (10);
 					for (i = 0; i < 10; i++)  {
@@ -559,4 +555,6 @@
 
 							/* leave peacefully */
 	getout ();
+	/* NOTREACHED */
+	return(0);
 }
Index: games/backgammon/backgammon/move.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/backgammon/move.c,v
retrieving revision 1.2
diff -u -r1.2 move.c
--- games/backgammon/backgammon/move.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/backgammon/move.c	31 Jul 2005 10:03:12 -0000
@@ -35,7 +35,6 @@
  * $DragonFly: src/games/backgammon/backgammon/move.c,v 1.2 2003/06/17 04:25:22 dillon Exp $
  */
 
-#include <stdlib.h>
 #include "back.h"
 
 #ifdef DEBUG
@@ -44,6 +43,18 @@
 static char	tests[20];
 #endif
 
+static void		 trymove(int, int);
+static struct BOARD	*bsave(void);
+static void		 binsert(struct BOARD *);
+static int		 bcomp(struct BOARD *, struct BOARD *);
+static void		 mvcheck(struct BOARD *, struct BOARD *);
+static void		 makefree(struct BOARD *);
+static struct BOARD	*nextfree(void);
+static void		 pickmove(void);
+static void		 boardcopy(struct BOARD *);
+static void		 movcmp(void);
+static int		 movegood(void);
+
 struct BOARD  {				/* structure of game position */
 	int	b_board[26];			/* board position */
 	int	b_in[2];			/* men in */
@@ -55,8 +66,6 @@
 
 struct BOARD *freeq = 0;
 struct BOARD *checkq = 0;
-struct BOARD *bsave();
-struct BOARD *nextfree();
 
 					/* these variables are values for the
 					 * candidate move */
@@ -83,13 +92,14 @@
 static int	cg[5];				/* candidate finish position */
 
 static int	race;				/* game reduced to a race */
-
-move (okay)
-int	okay;					/* zero if first move */
+
+void
+move(int okay)
 {
 	int	i;		/* index */
-	int	l;		/* last man */
+	int	l = 0;		/* last man */
 
+	/* first move? */
 	if (okay)  {
 						/* see if comp should double */
 		if (gvalue < 64 && dlast != cturn && dblgood())  {
@@ -173,11 +183,13 @@
 	}
 	fixtty (raw);				/* no more tty interrupt */
 }
-
-trymove (mvnum,swapped)
-int		mvnum;				/* number of move (rel zero) */
-int		swapped;			/* see if swapped also tested */
 
+/*
+ * mvnum is number of move (rel zero)
+ * see if swapped also tested
+ */
+static void
+trymove(int mvnum, int swapped)
 {
 	int	pos;			/* position on board */
 	int	rval;			/* value of roll */
@@ -228,9 +240,10 @@
 	if ((!swapped) && D0 != D1)
 		trymove (0,1);
 }
-
-struct BOARD *
-bsave ()  {
+
+static struct BOARD *
+bsave(void)
+{
 	int		i;		/* index */
 	struct BOARD	*now;		/* current position */
 
@@ -249,53 +262,52 @@
 	}
 	return (now);
 }
-
-binsert (new)
-struct BOARD	*new;					/* item to insert */
+
+static void
+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;
 }
-
-bcomp (a,b)
-struct BOARD	*a;
-struct BOARD	*b;
+
+static int
+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 */
@@ -309,10 +321,9 @@
 	}
 	return (0);				/* same position */
 }
-
-mvcheck (incumbent,candidate)
-struct BOARD 	*incumbent;
-struct BOARD 	*candidate;
+
+static void
+mvcheck(struct BOARD *incumbent, struct BOARD *candidate)
 {
 	int		i;
 	int		result;
@@ -331,16 +342,17 @@
 		incumbent->b_fn[i] = candidate->b_fn[i];
 	}
 }
-
-makefree (dead)
-struct BOARD	*dead;			/* dead position */
+
+static void
+makefree(struct BOARD *dead)
 {
 	dead->b_next = freeq;			/* add to freeq */
 	freeq = dead;
 }
 
-struct BOARD *
-nextfree ()  {
+static struct BOARD *
+nextfree(void)
+{
 	struct BOARD	*new;
 
 	if (freeq == 0)  {
@@ -356,8 +368,10 @@
 	}
 	return (new);
 }
-
-pickmove ()  {
+
+static void
+pickmove(void)
+{
 						/* current game position */
 	struct BOARD	*now = bsave();
 	struct BOARD	*next;		/* next move */
@@ -378,9 +392,9 @@
 
 	boardcopy (now);
 }
-
-boardcopy (s)
-struct BOARD	*s;			/* game situation */
+
+static void
+boardcopy(struct BOARD *s)
 {
 	int	i;			/* index */
 
@@ -395,10 +409,11 @@
 		g[i] = s->b_fn[i];
 	}
 }
-
-movcmp ()  {
+
+static void
+movcmp(void)
+{
 	int	i;
-	int	c;
 
 #ifdef DEBUG
 	if (trace == NULL)
@@ -468,8 +483,10 @@
 	}
 #endif
 }
-
-movegood ()  {
+
+static int
+movegood(void)
+{
 	int	n;
 
 	if (*offptr == 15)
Index: games/backgammon/backgammon/text.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/backgammon/text.c,v
retrieving revision 1.2
diff -u -r1.2 text.c
--- games/backgammon/backgammon/text.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/backgammon/text.c	31 Jul 2005 10:03:12 -0000
@@ -102,12 +102,9 @@
     "    Now you should be ready to begin the game.  Good luck!",
     "",
     0};
-
-
-int
-text (t)
-const char	*const *t;
 
+void
+text(const char *const *t)
 {
 	int		i;
 	const char	*s, *a;
Index: games/backgammon/common_source/allow.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/allow.c,v
retrieving revision 1.2
diff -u -r1.2 allow.c
--- games/backgammon/common_source/allow.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/common_source/allow.c	31 Jul 2005 10:03:12 -0000
@@ -37,7 +37,9 @@
 
 #include "back.h"
 
-movallow ()  {
+int
+movallow(void)
+{
 
 	int		i, m, iold;
 	int		r;
@@ -57,7 +59,7 @@
 				g[i] = bar+cturn*D1;
 			else
 				g[i] = bar+cturn*D0;
-			if (r = makmove(i))  {
+			if ((r = makmove(i)) != 0)  {
 				if (d0 || m == 4)
 					break;
 				swap;
Index: games/backgammon/common_source/back.h
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/back.h,v
retrieving revision 1.1
diff -u -r1.1 back.h
--- games/backgammon/common_source/back.h	17 Jun 2003 02:49:21 -0000	1.1
+++ games/backgammon/common_source/back.h	31 Jul 2005 10:03:12 -0000
@@ -34,6 +34,8 @@
  */
 
 #include <sgtty.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #define rnum(r)	(random()%r)
 #define D0	dice[0]
@@ -124,4 +126,66 @@
 extern int	begscr;		/* 'beginning' of screen
 				   (not including board) */
 
-void	getout();		/* function to exit backgammon cleanly */
+int	movallow(void);
+
+void	wrboard(void);
+
+void	getmove(void);
+int	movokay(int);
+
+void	fboard(void);
+void	refresh(void);
+void	curmove(int, int);
+void	newpos(void);
+void	clear(void);
+void	fancyc(char);
+void	clend(void);
+void	cline(void);
+int	getcaps(const char *);
+
+void	odds(int, int, int);
+int	count(void);
+int	canhit(int, int);
+
+int	makmove(int);
+void	moverr(int);
+void	movback(int);
+void	backone(int);
+
+void	save(int);
+void	recover(const char *);
+
+void	errexit(const char *);
+int	addbuf(int);
+void	buflush(void);
+char	readc(void);
+void	writec(char);
+void	writel(const char *);
+void	proll(void);
+void	wrint(int);
+void	gwrite(void);
+int	quit(void);
+int	yorn(char);
+void	wrhit(int);
+void	nexturn(void);
+void	getarg(int, char **);
+void	init(void);
+void	wrscore(void);
+void	fixtty(int);
+void	getout(void);		/* function to exit backgammon cleanly */
+void	roll(void);
+
+int	checkmove(int);
+
+void	dble(void);
+int	dblgood(void);
+int	freemen(int);
+int	trapped(int, int);
+
+void	move(int);
+
+#ifdef	TEACHGAMMON_TEXT
+int	text(const char *const *);
+#else
+void	text(const char *const *);
+#endif
Index: games/backgammon/common_source/board.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/board.c,v
retrieving revision 1.2
diff -u -r1.2 board.c
--- games/backgammon/common_source/board.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/common_source/board.c	31 Jul 2005 10:03:12 -0000
@@ -38,10 +38,14 @@
 #include <string.h>
 #include "back.h"
 
+static void	wrbsub(void);
+
 static int	i, j, k;
 static char	ln[60];
 
-wrboard ()  {
+void
+wrboard(void)
+{
 	int	l;
 	static const char	bl[] =
 		"|                       |   |                       |\n";
@@ -156,8 +160,10 @@
 	}
 	fixtty(raw);
 }
-
-wrbsub () {
+
+static void
+wrbsub(void)
+{
 	int		m;
 	char		d;
 
Index: games/backgammon/common_source/check.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/check.c,v
retrieving revision 1.2
diff -u -r1.2 check.c
--- games/backgammon/common_source/check.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/common_source/check.c	31 Jul 2005 10:03:12 -0000
@@ -37,7 +37,9 @@
 
 #include "back.h"
 
-getmove ()  {
+void
+getmove(void)
+{
 	int	i, c;
 
 	c = 0;
@@ -99,10 +101,9 @@
 		}
 	}
 }
-
-movokay (mv)
-int	mv;
 
+int
+movokay(int mv)
 {
 	int	i, m;
 
Index: games/backgammon/common_source/fancy.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/fancy.c,v
retrieving revision 1.3
diff -u -r1.3 fancy.c
--- games/backgammon/common_source/fancy.c	12 Nov 2003 14:53:52 -0000	1.3
+++ games/backgammon/common_source/fancy.c	31 Jul 2005 10:03:12 -0000
@@ -35,11 +35,15 @@
  * $DragonFly: src/games/backgammon/common_source/fancy.c,v 1.3 2003/11/12 14:53:52 eirikn Exp $
  */
 
-#include <stdlib.h>
 #include <string.h>
 #include <termcap.h>
 #include "back.h"
 
+static void	bsect(int, int, int, int);
+static void	fixpos(int, int, int, int, int);
+static void	fixcol(int, int, int, int, int);
+static void	newline(void);
+
 char	PC;			/* padding character */
 char	*BC;			/* backspace sequence */
 char	*CD;			/* clear to end of screen sequence */
@@ -81,9 +85,9 @@
 int	realr;
 int	realc;
 
-int	addbuf (int);
-
-fboard ()  {
+void
+fboard(void)
+{
 	int	i, j, l;
 
 	curmove (0,0);				/* do top line */
@@ -180,7 +184,7 @@
 	oldr = (off[1] < 0? off[1]+15: off[1]);
 	oldw = -(off[0] < 0? off[0]+15: off[0]);
 }
-
+
 /*
  * bsect (b,rpos,cpos,cnext)
  *	Print the contents of a board position.  "b" has the value of the
@@ -191,12 +195,8 @@
  * differently.
  */
 
-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 */
-
+static void
+bsect(int b, int rpos, int cpos, int cnext)
 {
 	int		j;			/* index */
 	int		n;			/* number of men on position */
@@ -204,6 +204,7 @@
 	int		k;			/* index */
 	char		pc;			/* color of men on position */
 
+	bct = 0;
 	n = abs(b);				/* initialize n and pc */
 	pc = (b > 0? 'r': 'w');
 
@@ -250,8 +251,10 @@
 		}
 	}
 }
-
-refresh()  {
+
+void
+refresh(void)
+{
 	int	i, r, c;
 
 	r = curr;				/* save current position */
@@ -307,19 +310,19 @@
 	newpos();
 	buflush();
 }
-
-fixpos (old,new,r,c,inc)
-int	old, new, r, c, inc;
 
+static void
+fixpos(int cur, int new, int r, int c, int inc)
 {
 	int		o, n, nv;
 	int		ov, nc;
 	char		col;
 
-	if (old*new >= 0)  {
-		ov = abs(old);
+	nc = 0;
+	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)  {
@@ -373,14 +376,13 @@
 	}
 	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);
 }
 
-fixcol (r,c,l,ch,inc)
-int		l, ch, r, c, inc;
-
+static void
+fixcol(int r, int c, int l, int ch, int inc)
 {
 	int	i;
 
@@ -391,10 +393,9 @@
 		fancyc (ch);
 	}
 }
-
-curmove (r,c)
-int	r, c;
 
+void
+curmove(int r, int c)
 {
 	if (curr == r && curc == c)
 		return;
@@ -406,18 +407,19 @@
 	curc = c;
 }
 
-newpos ()  {
+void
+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	j;			/* index */
 	int	n;			/* temporary variable */
 	char	*m;			/* string containing CM movement */
 
-
+	m = NULL;
 	if (realr == -1)		/* see if already there */
 		return;
 
@@ -435,55 +437,55 @@
 	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)  {
@@ -572,8 +574,10 @@
 	realr = -1;
 	realc = -1;
 }
-
-clear ()  {
+
+void
+clear(void)
+{
 	int	i;
 
 					/* double space if can't clear */
@@ -590,9 +594,10 @@
 	tputs (CL,CO,addbuf);		/* put CL in buffer */
 }
 
-
-fancyc (c)
-char	c;			/* character to output */
+
+/* input is character to output */
+void
+fancyc(char c)
 {
 	int	sp;		/* counts spaces in a tab */
 
@@ -646,11 +651,11 @@
 					/* use cursor movement routine */
 		curmove (curr,curc+1);
 }
-
-clend()  {
-	int	i;
-	char	*s;
 
+void
+clend(void)
+{
+	int	i;
 
 	if (CD)  {
 		tputs (CD,CO-curr,addbuf);
@@ -669,10 +674,10 @@
 	curmove (i,0);
 }
 
-cline ()  {
-	int	i;
+void
+cline(void)
+{
 	int	c;
-	char	*s;
 
 		return;
@@ -691,25 +696,25 @@
 	}
 }
 
-newline ()  {
+static void
+newline(void)
+{
 	cline();
 	if (curr == LI-1)
 		curmove (begscr,0);
 	else
 		curmove (curr+1,0);
 }
-
-int
-getcaps (s)
-const char	*s;
 
+int
+getcaps(const char *s)
 {
 	char	*code;		/* two letter code */
 	char	***cap;		/* pointer to cap string */
 	char		*bufp;		/* pointer to cap buffer */
 	char		tentry[1024];	/* temporary uncoded caps buffer */
 
-	tgetent (tentry, (char *)s);		/* get uncoded termcap entry */
+	tgetent (tentry, s);		/* get uncoded termcap entry */
 
 	LI = tgetnum ("li");		/* get number of lines */
 	if (LI == -1)
Index: games/backgammon/common_source/odds.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/odds.c,v
retrieving revision 1.2
diff -u -r1.2 odds.c
--- games/backgammon/common_source/odds.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/common_source/odds.c	31 Jul 2005 10:03:12 -0000
@@ -37,9 +37,8 @@
 
 #include "back.h"
 
-odds (r1,r2,val)
-int	r1;
-int		r2, val;
+void
+odds(int r1, int r2, int val)
 {
 	int	i, j;
 
@@ -62,7 +61,9 @@
 	}
 }
 
-count ()  {
+int
+count(void)
+{
 	int	i;
 	int	j;
 	int	total;
@@ -73,13 +74,12 @@
 			total += table[i][j];
 	return (total);
 }
-
-canhit (i,c)
-int	i, c;
 
+int
+canhit(int i, int c)
 {
 	int	j, k, b;
-	int		a, d, diff, place, addon, menstuck;
+	int	a, diff, place, addon, menstuck;
 
 	if (c == 0)
 		odds (0,0,0);
Index: games/backgammon/common_source/one.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/one.c,v
retrieving revision 1.2
diff -u -r1.2 one.c
--- games/backgammon/common_source/one.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/common_source/one.c	31 Jul 2005 10:03:12 -0000
@@ -37,9 +37,11 @@
 
 #include "back.h"
 
-makmove (i)
-int	i;
+static int	checkd(int);
+static int	last(void);
 
+int
+makmove(int i)
 {
 	int	n, d;
 	int		max;
@@ -90,10 +92,9 @@
 	}
 	return (0);
 }
-
-moverr (i)
-int	i;
 
+void
+moverr(int i)
 {
 	int	j;
 
@@ -113,27 +114,27 @@
 	movback (i);
 }
 
-
-checkd (d)
-int	d;
-
+static int
+checkd(int d)
 {
 	if (d0 != d)
 		swap;
 	return (0);
 }
 
-last ()  {
+static int
+last(void)
+{
 	int	i;
 
 	for (i = home-6*cturn; i != home; i += cturn)
 		if (board[i]*cturn > 0)
 			return (abs(home-i));
+	return(-1);
 }
-
-movback (i)
-int	i;
 
+void
+movback(int i)
 {
 	int	j;
 
@@ -141,9 +142,8 @@
 		backone(j);
 }
 
-backone (i)
-int	i;
-
+void
+backone(int i)
 {
 	board[p[i]] += cturn;
 	if (g[i] != home)  {
Index: games/backgammon/common_source/save.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/save.c,v
retrieving revision 1.2
diff -u -r1.2 save.c
--- games/backgammon/common_source/save.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/common_source/save.c	31 Jul 2005 10:03:12 -0000
@@ -39,6 +39,8 @@
 #include <errno.h>
 #include "back.h"
 
+static void	norec(const char *);
+
 static const char	confirm[] = "Are you sure you want to leave now?";
 static const char	prompt[] = "Enter a file name:  ";
 static const char	exist1[] = "The file '";
@@ -50,9 +52,8 @@
 static const char	rec[] = "\" to recover your game.\n\n";
 static const char	cantrec[] = "Can't recover file:  ";
 
-save (n)
-int	n;
-
+void
+save(int n)
 {
 	int	fdesc;
 	char	*fs;
@@ -140,13 +141,10 @@
 		clend();
 	getout ();
 }
-
-int
-recover (s)
-const char	*s;
 
+void
+recover(const char *s)
 {
-	int	i;
 	int		fdesc;
 
 	if ((fdesc = open (s,O_RDONLY)) == -1)
@@ -166,10 +164,8 @@
 	rflag = 1;
 }
 
-int
-norec (s)
-const char	*s;
-
+static void
+norec(const char *s)
 {
 	const char	*c;
 
Index: games/backgammon/common_source/subs.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/subs.c,v
retrieving revision 1.2
diff -u -r1.2 subs.c
--- games/backgammon/common_source/subs.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/common_source/subs.c	31 Jul 2005 10:03:12 -0000
@@ -36,7 +36,6 @@
  */
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include "back.h"
 
@@ -60,17 +59,16 @@
 	0
 };
 
-errexit (s)
-char	*s;
+void
+errexit(const char *s)
 {
 	write (2,"\n",1);
 	perror (s);
 	getout();
 }
 
-int addbuf (c)
-int	c;
-
+int
+addbuf(int c)
 {
 	buffnum++;
 	if (buffnum == BUFSIZ)  {
@@ -82,7 +80,9 @@
 	return (0);
 }
 
-buflush ()  {
+void
+buflush(void)
+{
 	if (buffnum < 0)
 		return;
 	buffnum++;
@@ -91,7 +91,9 @@
 	buffnum = -1;
 }
 
-readc () {
+char
+readc(void)
+{
 	char	c;
 
 	if (tflag)  {
@@ -116,8 +118,8 @@
 	return (c);
 }
 
-writec (c)
-char	c;
+void
+writec(char c)
 {
 	if (tflag)
 		fancyc (c);
@@ -126,8 +128,7 @@
 }
 
 void
-writel (l)
-const char	*l;
+writel(const char *l)
 {
 #ifdef DEBUG
 	const char	*s;
@@ -150,7 +151,9 @@
 		writec (*l++);
 }
 
-proll ()   {
+void
+proll(void)
+{
 	if (d0)
 		swap;
 	if (cturn == 1)
@@ -164,8 +167,8 @@
 		cline();
 }
 
-wrint (n)
-int	n;
+void
+wrint(int n)
 {
 	int	i, j, t;
 
@@ -179,12 +182,15 @@
 	writec (n%10+'0');
 }
 
-gwrite()  {
+void
+gwrite(void)
+{
 	int	r, c;
 
+	r = curr;
+	c = curc;
+
 	if (tflag)  {
-		r = curr;
-		c = curc;
 		curmove (16,0);
 	}
 
@@ -221,9 +227,9 @@
 	}
 }
 
-quit ()  {
-	int	i;
-
+int
+quit(void)
+{
 	if (tflag)  {
 		curmove (20,0);
 		clend();
@@ -242,8 +248,8 @@
 	return (0);
 }
 
-yorn (special)
-char	special;			/* special response */
+int
+yorn(char special)
 {
 	char	c;
 	int	i;
@@ -272,8 +278,8 @@
 	return (c == 'Y');
 }
 
-wrhit (i)
-int	i;
+void
+wrhit(int i)
 {
 	writel ("Blot hit on ");
 	wrint (i);
@@ -281,7 +287,9 @@
 	writec ('\n');
 }
 
-nexturn ()  {
+void
+nexturn(void)
+{
 	int	c;
 
 	cturn = -cturn;
@@ -296,14 +304,10 @@
 	colorptr += c;
 }
 
-getarg (argc, argv)
-int    argc;
-char	**argv;
-
+void
+getarg(int argc, char **argv)
 {
 	char	ch;
-	extern int optind;
-	extern char *optarg;
 	int i;
 
 	/* process arguments here.  dashes are ignored, nbrw are ignored
@@ -381,7 +385,9 @@
 		recover(argv[0]);
 }
 
-init ()  {
+void
+init(void)
+{
 	int	i;
 	for (i = 0; i < 26;)
 		board[i++] = 0;
@@ -397,7 +403,9 @@
 	dlast = 0;
 }
 
-wrscore ()  {
+void
+wrscore(void)
+{
 	writel ("Score:  ");
 	writel (color[1]);
 	writec (' ');
@@ -408,19 +416,20 @@
 	wrint (wscore);
 }
 
-fixtty (mode)
-int	mode;
+void
+fixtty(int mode)
 {
 	if (tflag)
 		newpos();
 	buflush();
 	tty.sg_flags = mode;
-	if (stty (0,&tty) < 0)
+	if (ioctl(0, TIOCSETP, &tty) < 0)
 		errexit("fixtty");
 }
 
 void
-getout ()  {
+getout(void)
+{
 	/* go to bottom of screen */
 	if (tflag)  {
 		curmove (23,0);
@@ -432,15 +441,18 @@
 	fixtty (old);
 	exit(0);
 }
-roll ()  {
+
+void
+roll(void)
+{
 	char	c;
 	int	row;
 	int	col;
 
 	if (iroll)  {
+		row = curr;
+		col = curc;
 		if (tflag)  {
-			row = curr;
-			col = curc;
 			curmove (17,0);
 		} else
 			writec ('\n');
Index: games/backgammon/common_source/table.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/common_source/table.c,v
retrieving revision 1.2
diff -u -r1.2 table.c
--- games/backgammon/common_source/table.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/common_source/table.c	31 Jul 2005 10:03:12 -0000
@@ -37,6 +37,9 @@
 
 #include "back.h"
 
+static int	dotable(char, int);
+static int	rsetbrd(void);
+
 const char	*const help2[] = {
 	"   Enter moves as <s>-<f> or <s>/<r> where <s> is the starting",
 	"position, <f> is the finishing position, and <r> is the roll.",
@@ -52,36 +55,33 @@
 
 static const struct state	atmata[] = {
 
-	'R', 1, 0,	'?', 7, 0,	'Q', 0, -3,	'B', 8, 25,
-	'9', 2, 25,	'8', 2, 25,	'7', 2, 25,	'6', 2, 25,
-	'5', 2, 25,	'4', 2, 25,	'3', 2, 25,	'2', 2, 19,
-	'1', 2, 15,	'0', 2, 25,	'.', 0, 0,	'9', 2, 25,
-	'8', 2, 25,	'7', 2, 25,	'6', 2, 25,	'5', 2, 25,
-
-	'4', 2, 25,	'3', 2, 25,	'2', 2, 25,	'1', 2, 25,
-	'0', 2, 25,	'/', 0, 32,	'-', 0, 39,	'.', 0, 0,
-	'/', 5, 32,	' ', 6, 3,	',', 6, 3,	'\n', 0, -1,
-	'6', 3, 28,	'5', 3, 28,	'4', 3, 28,	'3', 3, 28,
-	'2', 3, 28,	'1', 3, 28,	'.', 0, 0,	'H', 9, 61,
-
-	'9', 4, 61,	'8', 4, 61,	'7', 4, 61,	'6', 4, 61,
-	'5', 4, 61,	'4', 4, 61,	'3', 4, 61,	'2', 4, 53,
-	'1', 4, 51,	'0', 4, 61,	'.', 0, 0,	'9', 4, 61,
-	'8', 4, 61,	'7', 4, 61,	'6', 4, 61,	'5', 4, 61,
-	'4', 4, 61,	'3', 4, 61,	'2', 4, 61,	'1', 4, 61,
+	{'R', 1, 0},	{'?', 7, 0},	{'Q', 0, -3},	{'B', 8, 25},
+	{'9', 2, 25},	{'8', 2, 25},	{'7', 2, 25},	{'6', 2, 25},
+	{'5', 2, 25},	{'4', 2, 25},	{'3', 2, 25},	{'2', 2, 19},
+	{'1', 2, 15},	{'0', 2, 25},	{'.', 0, 0},	{'9', 2, 25},
+	{'8', 2, 25},	{'7', 2, 25},	{'6', 2, 25},	{'5', 2, 25},
+
+	{'4', 2, 25},	{'3', 2, 25},	{'2', 2, 25},	{'1', 2, 25},
+	{'0', 2, 25},	{'/', 0, 32},	{'-', 0, 39},	{'.', 0, 0},
+	{'/', 5, 32},	{' ', 6, 3},	{',', 6, 3},	{'\n', 0, -1},
+	{'6', 3, 28},	{'5', 3, 28},	{'4', 3, 28},	{'3', 3, 28},
+	{'2', 3, 28},	{'1', 3, 28},	{'.', 0, 0},	{'H', 9, 61},
+
+	{'9', 4, 61},	{'8', 4, 61},	{'7', 4, 61},	{'6', 4, 61},
+	{'5', 4, 61},	{'4', 4, 61},	{'3', 4, 61},	{'2', 4, 53},
+	{'1', 4, 51},	{'0', 4, 61},	{'.', 0, 0},	{'9', 4, 61},
+	{'8', 4, 61},	{'7', 4, 61},	{'6', 4, 61},	{'5', 4, 61},
+	{'4', 4, 61},	{'3', 4, 61},	{'2', 4, 61},	{'1', 4, 61},
 
-	'0', 4, 61,	' ', 6, 3,	',', 6, 3,	'-', 5, 39,
-	'\n', 0, -1,	'.', 0, 0
+	{'0', 4, 61},	{' ', 6, 3},	{',', 6, 3},	{'-', 5, 39},
+	{'\n', 0, -1},	{'.', 0, 0}
 };
 
-checkmove (ist)
-
-int	ist;
-
+int
+checkmove(int ist)
 {
 	int	j, n;
 	char	c;
-	char		a;
 
 domove:
 	if (ist == 0)  {
@@ -197,13 +197,11 @@
 	writec ('\007');
 	goto dochar;
 }
-
-dotable (c,i)
-char		c;
-int	i;
 
+static int
+dotable(char c, int i)
 {
-	int	a, j;
+	int	a;
 	int		test;
 
 	test = (c == 'R');
@@ -294,8 +292,10 @@
 
 	return (-5);
 }
-
-rsetbrd ()  {
+
+static int
+rsetbrd(void)
+{
 	int	i, j, n;
 
 	n = 0;
Index: games/backgammon/teachgammon/Makefile
===================================================================
RCS file: /home/dcvs/src/games/backgammon/teachgammon/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- games/backgammon/teachgammon/Makefile	17 Jun 2003 02:49:21 -0000	1.1
+++ games/backgammon/teachgammon/Makefile	31 Jul 2005 10:03:12 -0000
@@ -1,13 +1,14 @@
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 
 PROG=	teachgammon
-CFLAGS+=-DV7 -I${.CURDIR}/../common_source
+CFLAGS+=-DTEACHGAMMON_TEXT -DV7 -I${.CURDIR}/../common_source
 SRCS=	allow.c board.c check.c data.c fancy.c init.c odds.c one.c save.c \
 	subs.c table.c teach.c ttext1.c ttext2.c tutor.c
-DPADD=	${LIBTERMCAP} ${LIBCOMPAT}
-LDADD=	-ltermcap -lcompat
+DPADD=	${LIBTERMCAP}
+LDADD=	-ltermcap
 HIDEGAME=hidegame
 NOMAN=	noman
+WARNS?=	6
 
 .PATH:	${.CURDIR}/../common_source
 
Index: games/backgammon/teachgammon/data.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/teachgammon/data.c,v
retrieving revision 1.2
diff -u -r1.2 data.c
--- games/backgammon/teachgammon/data.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/teachgammon/data.c	31 Jul 2005 10:03:12 -0000
@@ -218,98 +218,98 @@
 const struct situatn  test[] = {
 	{
 		{0,2,0,0,0,0,-5,0,-3,0,0,0,5,-5,0,0,0,3,0,5,0,0,0,0,-2,0},
-		3, 1, {8,6,0,0}, {5,5,0,0}, 4, 2, text0
+		3, 1, {8,6,0,0}, {5,5,0,0}, 4, 2, {text0}
 	},
 	{
 		{0,2,0,0,0,-2,-4,0,-2,0,0,0,5,-5,0,0,0,2,0,4,0,2,0,0,-2,0},
-		5, 5, {13,13,8,8}, {8,8,3,3}, 6, 6, text1
+		5, 5, {13,13,8,8}, {8,8,3,3}, 6, 6, {text1}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,2,-2,0,0,0,3,-3,0,0,0,2,2,4,0,2,0,0,-2,0},
-		6, 5, {13,8,0,0}, {8,2,0,0}, 1, 2, text2
+		6, 5, {13,8,0,0}, {8,2,0,0}, 1, 2, {text2}
 	},
 	{
 		{0,0,-1,-2,0,-2,-4,2,-2,0,0,0,2,-2,0,1,0,2,2,4,0,2,0,0,-2,0},
-		4, 5, {24,20,0,0}, {20,15,0,0}, 2, 5, text3
+		4, 5, {24,20,0,0}, {20,15,0,0}, 2, 5, {text3}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,3,-2,0,0,0,2,-2,0,-1,0,2,2,4,0,2,0,0,-1,-1},
-		2, 3, {25,24,0,0}, {22,22,0,0}, 4, 1, text4
+		2, 3, {25,24,0,0}, {22,22,0,0}, 4, 1, {text4}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,2,-2,0,0,0,3,-2,0,-1,0,2,2,4,0,2,-2,0,0,0},
-		6, 1, {22,16,0,0}, {16,15,0,0}, 3, 3, text5
+		6, 1, {22,16,0,0}, {16,15,0,0}, 3, 3, {text5}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,2,-2,0,0,0,3,-2,0,-2,0,0,2,2,2,2,2,0,0,-1},
-		3, 5, {0,0,0,0}, {0,0,0,0}, 5, 4, text6
+		3, 5, {0,0,0,0}, {0,0,0,0}, 5, 4, {text6}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,1,-2,0,0,0,3,-2,0,-2,1,0,2,2,2,2,2,0,0,-1},
-		6, 6, {0,0,0,0}, {0,0,0,0}, 3, 6, text7
+		6, 6, {0,0,0,0}, {0,0,0,0}, 3, 6, {text7}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,0,-2,0,0,0,3,-2,0,-2,2,0,2,2,2,2,2,0,0,-1},
-		2, 6, {25,23,0,0}, {23,17,0,0}, 5, 1, text8
+		2, 6, {25,23,0,0}, {23,17,0,0}, 5, 1, {text8}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,0,-2,0,0,0,2,-2,0,-2,2,0,3,2,2,2,2,0,0,-1},
-		1, 1, {25,24,15,15}, {24,23,14,14}, 4, 6, text9
+		1, 1, {25,24,15,15}, {24,23,14,14}, 4, 6, {text9}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,0,-2,0,0,0,0,-2,-2,0,3,0,4,2,2,2,2,-1,0,0},
-		6, 2, {23,17,0,0}, {17,15,0,0}, 1, 3, text10
+		6, 2, {23,17,0,0}, {17,15,0,0}, 1, 3, {text10}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,0,-2,0,0,0,0,-2,-2,-1,2,0,3,4,2,2,2,0,0,0},
-		4, 3, {15,14,0,0}, {11,11,0,0}, 5, 3, text11
+		4, 3, {15,14,0,0}, {11,11,0,0}, 5, 3, {text11}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,0,-2,0,0,-2,0,-2,-1,0,0,0,3,5,2,3,2,0,0,0},
-		6, 1, {14,13,0,0}, {8,12,0,0}, 4, 4, text12
+		6, 1, {14,13,0,0}, {8,12,0,0}, 4, 4, {text12}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,0,-3,0,0,-2,-1,-1,0,0,0,0,0,5,2,2,5,0,0,0},
-		2, 1, {13,12,0,0}, {11,11,0,0}, 2, 1, text13
+		2, 1, {13,12,0,0}, {11,11,0,0}, 2, 1, {text13}
 	},
 	{
 		{0,0,0,-2,0,-2,-4,0,-3,0,0,-4,0,0,0,0,0,0,0,5,2,2,3,1,1,0},
-		2, 5, {8,11,0,0}, {6,6,0,0}, 6, 3, text14
+		2, 5, {8,11,0,0}, {6,6,0,0}, 6, 3, {text14}
 	},
 	{
 		{0,0,0,-2,0,-2,-6,0,-2,0,0,-3,0,0,0,0,0,0,0,4,2,2,2,1,1,0},
-		4, 3, {11,11,0,0}, {7,8,0,0}, 2, 5, text15
+		4, 3, {11,11,0,0}, {7,8,0,0}, 2, 5, {text15}
 	},
 	{
 		{0,0,0,-2,0,-2,-6,-1,-3,0,0,-1,0,0,0,0,0,0,0,4,1,2,2,0,1,0},
-		2, 6, {8,11,0,0}, {6,5,0,0}, 6, 1, text16
+		2, 6, {8,11,0,0}, {6,5,0,0}, 6, 1, {text16}
 	},
 	{
 		{0,0,0,-2,0,-3,-7,-1,-2,0,0,0,0,0,0,0,0,0,0,3,1,2,2,0,0,0},
-		5, 3, {8,7,0,0}, {3,4,0,0}, 5, 2, text17
+		5, 3, {8,7,0,0}, {3,4,0,0}, 5, 2, {text17}
 	},
 	{
 		{0,0,0,-3,-1,-3,-7,0,-1,0,0,0,0,0,0,0,0,0,0,3,0,1,2,1,0,0},
-		3, 3, {8,3,3,3}, {5,0,0,0}, 1, 6, text18
+		3, 3, {8,3,3,3}, {5,0,0,0}, 1, 6, {text18}
 	},
 	{
 		{0,0,0,0,-1,-4,-7,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,0,0},
-		1, 4, {4,5,0,0}, {0,4,0,0}, 2, 3, text19
+		1, 4, {4,5,0,0}, {0,4,0,0}, 2, 3, {text19}
 	},
 	{
 		{0,0,0,0,-1,-3,-7,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0},
-		5, 6, {6,5,0,0}, {0,0,0,0}, 1, 4, text20
+		5, 6, {6,5,0,0}, {0,0,0,0}, 1, 4, {text20}
 	},
 	{
 		{0,0,0,0,-1,-2,-6,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0},
-		2, 4, {4,6,0,0}, {0,4,0,0}, 6, 2, text21
+		2, 4, {4,6,0,0}, {0,4,0,0}, 6, 2, {text21}
 	},
 	{
 		{0,0,0,0,-1,-2,-5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0},
-		3, 1, {4,3,0,0}, {3,0,0,0}, 4, 3, text22
+		3, 1, {4,3,0,0}, {3,0,0,0}, 4, 3, {text22}
 	},
 	{
 		{0,0,0,0,0,-2,-5,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,0,0,0}, 0, 0, text23
+		0, 0, {0,0,0,0}, {0,0,0,0}, 0, 0, {text23}
 	}
 };
Index: games/backgammon/teachgammon/teach.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/teachgammon/teach.c,v
retrieving revision 1.2
diff -u -r1.2 teach.c
--- games/backgammon/teachgammon/teach.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/teachgammon/teach.c	31 Jul 2005 10:03:12 -0000
@@ -38,22 +38,9 @@
 
 #include <string.h>
 #include <sys/types.h>
-#include <unistd.h>
 #include <signal.h>
 #include "back.h"
-
-extern char	*hello[];
-extern char	*list[];
-extern char	*intro1[];
-extern char	*intro2[];
-extern char	*moves[];
-extern char	*remove[];
-extern char	*hits[];
-extern char	*endgame[];
-extern char	*doubl[];
-extern char	*stragy[];
-extern char	*prog[];
-extern char	*lastch[];
+#include "tutor.h"
 
 extern char	ospeed;			/* tty output speed for termlib */
 
@@ -70,10 +57,8 @@
 	0
 };
 
-main (argc,argv)
-int	argc;
-char	**argv;
-
+int
+main(int argc, char **argv)
 {
 	int	i;
 
@@ -81,8 +66,8 @@
 	setgid(getgid());
 
 	acnt = 1;
-	signal (SIGINT,getout);
-	if (gtty (0,&tty) == -1)			/* get old tty mode */
+	signal (SIGINT,(sig_t)getout);
+	if (ioctl(0,TIOCGETP,&tty) == -1)			/* get old tty mode */
 		errexit ("teachgammon(gtty)");
 	old = tty.sg_flags;
 #ifdef V7
@@ -111,48 +96,52 @@
 			leave();
 
 		case 2:
-			if (i = text(intro1))
+			if ((i = text(intro1)) != 0)
 				break;
 			wrboard();
-			if (i = text(intro2))
+			if ((i = text(intro2)) != 0)
 				break;
 
 		case 3:
-			if (i = text(moves))
+			if ((i = text(moves)) != 0)
 				break;
 
 		case 4:
-			if (i = text(remove))
+			if ((i = text(remove)) != 0)
 				break;
 
 		case 5:
-			if (i = text(hits))
+			if ((i = text(hits)) != 0)
 				break;
 
 		case 6:
-			if (i = text(endgame))
+			if ((i = text(endgame)) != 0)
 				break;
 
 		case 7:
-			if (i = text(doubl))
+			if ((i = text(doubl)) != 0)
 				break;
 
 		case 8:
-			if (i = text(stragy))
+			if ((i = text(stragy)) != 0)
 				break;
 
 		case 9:
-			if (i = text(prog))
+			if ((i = text(prog)) != 0)
 				break;
 
 		case 10:
-			if (i = text(lastch))
+			if ((i = text(lastch)) != 0)
 				break;
 		}
 	tutor();
+	/* NOTREACHED */
+	return(0);
 }
 
-leave()  {
+void
+leave(void)
+{
 	int i;
 	if (tflag)
 		clear();
Index: games/backgammon/teachgammon/ttext1.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/teachgammon/ttext1.c,v
retrieving revision 1.2
diff -u -r1.2 ttext1.c
--- games/backgammon/teachgammon/ttext1.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/teachgammon/ttext1.c	31 Jul 2005 10:03:12 -0000
@@ -98,7 +98,7 @@
     "have any pieces of either color.",
     "",
     0};
-
+
 const char	*const moves[] = {
     "\nMoves and Points:",
     "\n   Moves are made along the positions on the board according to",
@@ -153,7 +153,7 @@
     "many moves as possible.",
     "",
     0};
-
+
 const char	*const hits[] = {
     "\nHitting Blots:",
     "\n   Although two men on a position form an impenetrable point, a",
@@ -170,7 +170,7 @@
     "bar, as well as being set back the full distance of the board.",
     "",
     0};
-
+
 const char	*const endgame[] = {
     "\nEnding the Game and Scoring:",
     "\n   Winning a game usually wins one point, the normal value of a",
Index: games/backgammon/teachgammon/ttext2.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/teachgammon/ttext2.c,v
retrieving revision 1.2
diff -u -r1.2 ttext2.c
--- games/backgammon/teachgammon/ttext2.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/teachgammon/ttext2.c	31 Jul 2005 10:03:12 -0000
@@ -70,7 +70,7 @@
     "tional hints on strategy are presented in the practice game.",
     "",
     0};
-
+
 const char	*const prog[] = {
    "\nThe Program and How It Works:",
    "\n   A general rule of thumb is when you don't know what to do,",
@@ -123,11 +123,9 @@
    "torial starts.",
    "",
    0};
-
-int
-text (txt)
-const char	*const *txt;
 
+int
+text(const char *const *txt)
 {
 	const char	*const *begin;
 	const char	*a;
Index: games/backgammon/teachgammon/tutor.c
===================================================================
RCS file: /home/dcvs/src/games/backgammon/teachgammon/tutor.c,v
retrieving revision 1.2
diff -u -r1.2 tutor.c
--- games/backgammon/teachgammon/tutor.c	17 Jun 2003 04:25:22 -0000	1.2
+++ games/backgammon/teachgammon/tutor.c	31 Jul 2005 10:03:12 -0000
@@ -38,15 +38,14 @@
 #include "back.h"
 #include "tutor.h"
 
-extern int	maxmoves;
-extern const char	*const finis[];
-
-extern const struct situatn	test[];
+static void	clrest(void);
+static int	brdeq(const int *, const int *);
 
 static const char	better[] = "That is a legal move, but there is a better one.\n";
 
 void
-tutor ()  {
+tutor(void)
+{
 	int	i, j;
 
 	i = 0;
@@ -130,7 +129,9 @@
 	leave();
 }
 
-clrest ()  {
+static void
+clrest(void)
+{
 	int	r, c, j;
 
 	r = curr;
@@ -142,10 +143,8 @@
 	curmove (r,c);
 }
 
-int
-brdeq (b1,b2)
-const int  *b1, *b2;
-
+static int
+brdeq(const int *b1, const int *b2)
 {
 	const int  *e;
 
Index: games/backgammon/teachgammon/tutor.h
===================================================================
RCS file: /home/dcvs/src/games/backgammon/teachgammon/tutor.h,v
retrieving revision 1.1
diff -u -r1.1 tutor.h
--- games/backgammon/teachgammon/tutor.h	17 Jun 2003 02:49:21 -0000	1.1
+++ games/backgammon/teachgammon/tutor.h	31 Jul 2005 10:03:12 -0000
@@ -33,6 +33,9 @@
  *	@(#)tutor.h	8.1 (Berkeley) 5/31/93
  */
 
+void	leave(void);
+void	tutor(void);
+
 struct situatn  {
 	int	brd[26];
 	int	roll1;
@@ -58,6 +61,7 @@
 extern	const char	*const opts;
 extern	const char	*const prog[];
 extern	const char	*const prompt;
+extern	const char	*const remove[];
 extern	const char	*const removepiece[];
 extern	const char	*const stragy[];
 extern	const struct situatn	test[];

Attachment: pgp00013.pgp
Description: PGP signature



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]