diff options
Diffstat (limited to 'backgammon/common_source')
-rw-r--r-- | backgammon/common_source/back.h | 12 | ||||
-rw-r--r-- | backgammon/common_source/board.c | 8 | ||||
-rw-r--r-- | backgammon/common_source/fancy.c | 56 | ||||
-rw-r--r-- | backgammon/common_source/one.c | 11 | ||||
-rw-r--r-- | backgammon/common_source/save.c | 8 | ||||
-rw-r--r-- | backgammon/common_source/subs.c | 8 | ||||
-rw-r--r-- | backgammon/common_source/table.c | 13 |
7 files changed, 64 insertions, 52 deletions
diff --git a/backgammon/common_source/back.h b/backgammon/common_source/back.h index 557cfc6b..fe8737c6 100644 --- a/backgammon/common_source/back.h +++ b/backgammon/common_source/back.h @@ -1,4 +1,4 @@ -/* $NetBSD: back.h,v 1.15 2005/07/01 01:12:39 jmc Exp $ */ +/* $NetBSD: back.h,v 1.16 2009/08/12 05:17:57 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -131,22 +131,17 @@ extern int begscr; /* 'beginning' of screen int addbuf(int); void backone(int); -void bsect(int, int, int, int); void buflush(void); int canhit(int, int); -int checkd(int); int checkmove(int); void clear(void); void clend(void); void cline(void); int count(void); void curmove(int, int); -int dotable(int, int); void errexit(const char *) __attribute__((__noreturn__)); void fancyc(int); void fboard(void); -void fixcol(int, int, int, int, int); -void fixpos(int, int, int, int, int); void fixtty(struct termios *); void getarg(char ***); int getcaps(const char *); @@ -154,17 +149,14 @@ void getmove(void); void getout(int) __attribute__((__noreturn__)); void gwrite(void); void init(void); -int last(void); int main(int, char *[]); int makmove(int); int movallow(void); void movback(int); void moverr(int); int movokay(int); -void newline(void); void newpos(void); void nexturn(void); -void norec(const char *) __attribute__((__noreturn__)); void odds(int, int, int); void proll(void); int quit(void); @@ -172,11 +164,9 @@ int readc(void); void recover(const char *); void refresh(void); void roll(void); -int rsetbrd(void); void save(int); int text(const char *const *); void wrboard(void); -void wrbsub(void); void wrhit(int); void wrint(int); void writec(int); diff --git a/backgammon/common_source/board.c b/backgammon/common_source/board.c index 1c76eddb..2c52ea69 100644 --- a/backgammon/common_source/board.c +++ b/backgammon/common_source/board.c @@ -1,4 +1,4 @@ -/* $NetBSD: board.c,v 1.8 2005/07/01 01:12:39 jmc Exp $ */ +/* $NetBSD: board.c,v 1.9 2009/08/12 05:17:57 dholland 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.8 2005/07/01 01:12:39 jmc Exp $"); +__RCSID("$NetBSD: board.c,v 1.9 2009/08/12 05:17:57 dholland Exp $"); #endif #endif /* not lint */ @@ -43,6 +43,8 @@ __RCSID("$NetBSD: board.c,v 1.8 2005/07/01 01:12:39 jmc Exp $"); static int i, j, k; static char ln[60]; +static void wrbsub(void); + void wrboard(void) { @@ -160,7 +162,7 @@ lastline: fixtty(&raw); } -void +static void wrbsub(void) { int m; diff --git a/backgammon/common_source/fancy.c b/backgammon/common_source/fancy.c index fcbeabb4..9116e0ad 100644 --- a/backgammon/common_source/fancy.c +++ b/backgammon/common_source/fancy.c @@ -1,4 +1,4 @@ -/* $NetBSD: fancy.c,v 1.13 2005/07/01 01:12:39 jmc Exp $ */ +/* $NetBSD: fancy.c,v 1.14 2009/08/12 05:17:57 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,12 +34,24 @@ #if 0 static char sccsid[] = "@(#)fancy.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: fancy.c,v 1.13 2005/07/01 01:12:39 jmc Exp $"); +__RCSID("$NetBSD: fancy.c,v 1.14 2009/08/12 05:17:57 dholland Exp $"); #endif #endif /* not lint */ #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); + +/* + * These need to be declared so they come out as commons, because + * termcap might or might not define some of them. Our termcap defines + * PC, BC, and UP only. This is gross. + * + * XXX: rewrite this crap using curses. + */ char PC; /* padding character */ char *BC; /* backspace sequence */ char *CD; /* clear to end of screen sequence */ @@ -52,33 +64,33 @@ char *ML; /* row cursor movement map */ char *ND; /* forward cursor sequence */ char *UP; /* up cursor sequence */ -int lHO; /* length of HO */ -int lBC; /* length of BC */ -int lND; /* length of ND */ -int lUP; /* length of UP */ -int CO; /* number of columns */ -int LI; /* number of lines */ -int *linect; /* array of lengths of lines on screen (the +static int lHO; /* length of HO */ +static int lBC; /* length of BC */ +static int lND; /* length of ND */ +static int lUP; /* length of UP */ +static int CO; /* number of columns */ +static int LI; /* number of lines */ +static int *linect; /* array of lengths of lines on screen (the * actual screen is not stored) */ /* two letter codes */ -char tcap[] = "bccdceclcmhomcmlndup"; +static char tcap[] = "bccdceclcmhomcmlndup"; /* corresponding strings */ -char **tstr[] = {&BC, &CD, &CE, &CL, &CM, &HO, &MC, &ML, &ND, &UP}; +static char **tstr[] = {&BC, &CD, &CE, &CL, &CM, &HO, &MC, &ML, &ND, &UP}; int buffnum; /* pointer to output buffer */ -char tbuf[1024]; /* buffer for decoded termcap entries */ +static 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}; +static 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; +static int oldr; +static int oldw; /* "real" cursor positions, so it knows when to reposition. These are -1 if * curr and curc are accurate */ -int realr; -int realc; +static int realr; +static int realc; void fboard(void) @@ -187,7 +199,7 @@ fboard(void) * to see if the position is a player's home, since those are printed * differently. */ -void +static void bsect(int b, int rpos, int cpos, int cnext) { int j; /* index */ @@ -294,7 +306,7 @@ refresh(void) buflush(); } -void +static void fixpos(int cur, int new, int r, int c, int inc) { int o, n, nv; @@ -380,7 +392,7 @@ fixpos(int cur, int new, int r, int c, int inc) fixcol(r + inc * new, c + 1, abs(cur + new), ' ', inc); } -void +static void fixcol(int r, int c, int l, int ch, int inc) { int i; @@ -683,7 +695,7 @@ cline(void) } } -void +static void newline(void) { cline(); diff --git a/backgammon/common_source/one.c b/backgammon/common_source/one.c index dde3096a..215a1890 100644 --- a/backgammon/common_source/one.c +++ b/backgammon/common_source/one.c @@ -1,4 +1,4 @@ -/* $NetBSD: one.c,v 1.6 2005/07/01 01:12:39 jmc Exp $ */ +/* $NetBSD: one.c,v 1.7 2009/08/12 05:17:57 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,12 +34,15 @@ #if 0 static char sccsid[] = "@(#)one.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: one.c,v 1.6 2005/07/01 01:12:39 jmc Exp $"); +__RCSID("$NetBSD: one.c,v 1.7 2009/08/12 05:17:57 dholland Exp $"); #endif #endif /* not lint */ #include "back.h" +static int checkd(int); +static int last(void); + int makmove(int i) { @@ -115,7 +118,7 @@ moverr(int i) } -int +static int checkd(int d) { if (d0 != d) @@ -123,7 +126,7 @@ checkd(int d) return (0); } -int +static int last(void) { int i; diff --git a/backgammon/common_source/save.c b/backgammon/common_source/save.c index b6f6a30f..2e7f29c1 100644 --- a/backgammon/common_source/save.c +++ b/backgammon/common_source/save.c @@ -1,4 +1,4 @@ -/* $NetBSD: save.c,v 1.12 2006/03/18 23:25:30 christos Exp $ */ +/* $NetBSD: save.c,v 1.13 2009/08/12 05:17:57 dholland 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.12 2006/03/18 23:25:30 christos Exp $"); +__RCSID("$NetBSD: save.c,v 1.13 2009/08/12 05:17:57 dholland Exp $"); #endif #endif /* not lint */ @@ -53,6 +53,8 @@ static const char type[] = "'.\nType \"backgammon "; static const char rec[] = "\" to recover your game.\n\n"; static const char cantrec[] = "Can't recover file: "; +static void norec(const char *) __attribute__((__noreturn__)); + void save(int n) { @@ -164,7 +166,7 @@ recover(const char *s) rflag = 1; } -void +static void norec(const char *s) { const char *c; diff --git a/backgammon/common_source/subs.c b/backgammon/common_source/subs.c index 62529fe0..aa139222 100644 --- a/backgammon/common_source/subs.c +++ b/backgammon/common_source/subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: subs.c,v 1.16 2007/12/15 19:44:39 perry Exp $ */ +/* $NetBSD: subs.c,v 1.17 2009/08/12 05:17:57 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,20 +34,20 @@ #if 0 static char sccsid[] = "@(#)subs.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: subs.c,v 1.16 2007/12/15 19:44:39 perry Exp $"); +__RCSID("$NetBSD: subs.c,v 1.17 2009/08/12 05:17:57 dholland Exp $"); #endif #endif /* not lint */ #include "back.h" int buffnum; -char outbuff[BUFSIZ]; +static char outbuff[BUFSIZ]; static const char plred[] = "Player is red, computer is white."; static const char plwhite[] = "Player is white, computer is red."; static const char nocomp[] = "(No computer play.)"; -const char *const descr[] = { +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)", diff --git a/backgammon/common_source/table.c b/backgammon/common_source/table.c index 1b817dca..869d802e 100644 --- a/backgammon/common_source/table.c +++ b/backgammon/common_source/table.c @@ -1,4 +1,4 @@ -/* $NetBSD: table.c,v 1.9 2006/03/18 23:23:33 christos Exp $ */ +/* $NetBSD: table.c,v 1.10 2009/08/12 05:17:57 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,13 +34,13 @@ #if 0 static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: table.c,v 1.9 2006/03/18 23:23:33 christos Exp $"); +__RCSID("$NetBSD: table.c,v 1.10 2009/08/12 05:17:57 dholland Exp $"); #endif #endif /* not lint */ #include "back.h" -const char *const help2[] = { +static 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.", "Remember, each die roll must be moved separately.", @@ -77,6 +77,9 @@ static const struct state atmata[] = { {'\n', 0, -1}, {'.', 0, 0} }; +static int dotable(int, int); +static int rsetbrd(void); + int checkmove(int ist) { @@ -194,7 +197,7 @@ dochar: goto dochar; } -int +static int dotable(int c, int i) { int a; @@ -288,7 +291,7 @@ dotable(int c, int i) return (-5); } -int +static int rsetbrd(void) { int i, j, n; |