diff options
-rw-r--r-- | games/backgammon/backgammon/main.c | 46 | ||||
-rw-r--r-- | games/backgammon/backgammon/text.c | 10 | ||||
-rw-r--r-- | games/backgammon/common_source/allow.c | 6 | ||||
-rw-r--r-- | games/backgammon/common_source/back.h | 23 | ||||
-rw-r--r-- | games/backgammon/common_source/board.c | 8 | ||||
-rw-r--r-- | games/backgammon/common_source/check.c | 6 | ||||
-rw-r--r-- | games/backgammon/common_source/fancy.c | 6 | ||||
-rw-r--r-- | games/backgammon/common_source/init.c | 14 | ||||
-rw-r--r-- | games/backgammon/common_source/save.c | 28 | ||||
-rw-r--r-- | games/backgammon/common_source/subs.c | 16 | ||||
-rw-r--r-- | games/backgammon/common_source/table.c | 8 | ||||
-rw-r--r-- | games/backgammon/teachgammon/data.c | 102 | ||||
-rw-r--r-- | games/backgammon/teachgammon/teach.c | 30 | ||||
-rw-r--r-- | games/backgammon/teachgammon/ttext1.c | 24 | ||||
-rw-r--r-- | games/backgammon/teachgammon/ttext2.c | 20 | ||||
-rw-r--r-- | games/backgammon/teachgammon/tutor.c | 10 | ||||
-rw-r--r-- | games/backgammon/teachgammon/tutor.h | 40 |
17 files changed, 199 insertions, 198 deletions
diff --git a/games/backgammon/backgammon/main.c b/games/backgammon/backgammon/main.c index 76847637b8a..9945e6f2b04 100644 --- a/games/backgammon/backgammon/main.c +++ b/games/backgammon/backgammon/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.5 1998/08/29 23:19:07 pjanzen Exp $ */ +/* $OpenBSD: main.c,v 1.6 1999/07/31 21:57:35 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.5 1998/08/29 23:19:07 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.6 1999/07/31 21:57:35 pjanzen Exp $"; #endif #endif /* not lint */ @@ -54,17 +54,17 @@ static char rcsid[] = "$OpenBSD: main.c,v 1.5 1998/08/29 23:19:07 pjanzen Exp $" #define MVPAUSE 5 /* time to sleep when stuck */ /* #define MAXUSERS 35 */ /* maximum number of users */ -char *instr[]; /* text of instructions */ -speed_t ospeed; /* tty output speed */ +extern const char *const instr[]; /* text of instructions */ +speed_t ospeed; /* tty output speed */ -char *helpm[] = { /* help message */ +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 }; -char *contin[] = { /* pause message */ +const char *const contin[] = { /* pause message */ "(Type a newline to continue.)", "", 0 @@ -80,23 +80,23 @@ char *contin[] = { /* pause message */ * static char user2b[] = * " users on the system, so you cannot play\nanother game. "; */ -static char rules[] = "\nDo you want the rules of the game?"; -static char noteach[] = "Teachgammon not available!\n\007"; -static char need[] = "Do you need instructions for this program?"; -static char askcol[] = +static const char rules[] = "\nDo you want the rules of the game?"; +static const char noteach[] = "Teachgammon not available!\n\007"; +static const char need[] = "Do you need instructions for this program?"; +static const char askcol[] = "Enter 'r' to play red, 'w' to play white, 'b' to play both:"; -static char rollr[] = "Red rolls a "; -static char rollw[] = ". White rolls a "; -static char rstart[] = ". Red starts.\n"; -static char wstart[] = ". White starts.\n"; -static char toobad1[] = "Too bad, "; -static char unable[] = " is unable to use that roll.\n"; -static char toobad2[] = ". Too bad, "; -static char cantmv[] = " can't move.\n"; -static char bgammon[] = "Backgammon! "; -static char gammon[] = "Gammon! "; -static char again[] = ".\nWould you like to play again?"; -static char svpromt[] = "Would you like to save this game?"; +static const char rollr[] = "Red rolls a "; +static const char rollw[] = ". White rolls a "; +static const char rstart[] = ". Red starts.\n"; +static const char wstart[] = ". White starts.\n"; +static const char toobad1[] = "Too bad, "; +static const char unable[] = " is unable to use that roll.\n"; +static const char toobad2[] = ". Too bad, "; +static const char cantmv[] = " can't move.\n"; +static const char bgammon[] = "Backgammon! "; +static const char gammon[] = "Gammon! "; +static const char again[] = ".\nWould you like to play again?"; +static const char svpromt[] = "Would you like to save this game?"; int main (argc,argv) @@ -150,7 +150,7 @@ main (argc,argv) fixtty(&raw); /* go into raw mode */ /* check if restored game and save flag for later */ - if (rfl = rflag) { + if ((rfl = rflag)) { wrboard(); /* print board */ /* if new game, pretend to be a non-restored game */ if (cturn == 0) diff --git a/games/backgammon/backgammon/text.c b/games/backgammon/backgammon/text.c index 6cc86bf3985..afa9a4c17b2 100644 --- a/games/backgammon/backgammon/text.c +++ b/games/backgammon/backgammon/text.c @@ -1,4 +1,4 @@ -/* $OpenBSD: text.c,v 1.2 1998/03/19 11:13:10 pjanzen Exp $ */ +/* $OpenBSD: text.c,v 1.3 1999/07/31 21:57:35 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,13 +37,13 @@ #if 0 static char sccsid[] = "@(#)text.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: text.c,v 1.2 1998/03/19 11:13:10 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: text.c,v 1.3 1999/07/31 21:57:35 pjanzen Exp $"; #endif #endif /* not lint */ #include "back.h" -char *instr[] = { +const char *const instr[] = { " This program reacts to keystrokes immediately, without waiting", "for a newline. Consequently, special characters such as RUBOUT", "and ESC will not perform their special functions during most of", @@ -106,10 +106,10 @@ char *instr[] = { int text(t) - char **t; + const char *const *t; { int i; - char *s, *a; + const char *s, *a; fixtty(&noech); while (*t != 0) { diff --git a/games/backgammon/common_source/allow.c b/games/backgammon/common_source/allow.c index 0f8ce7198a6..b210a624ad3 100644 --- a/games/backgammon/common_source/allow.c +++ b/games/backgammon/common_source/allow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: allow.c,v 1.2 1998/03/19 11:13:13 pjanzen Exp $ */ +/* $OpenBSD: allow.c,v 1.3 1999/07/31 21:57:40 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)allow.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: allow.c,v 1.2 1998/03/19 11:13:13 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: allow.c,v 1.3 1999/07/31 21:57:40 pjanzen Exp $"; #endif #endif /* not lint */ @@ -63,7 +63,7 @@ movallow() g[i] = bar + cturn * D1; else g[i] = bar + cturn * D0; - if (r = makmove(i)) { + if ((r = makmove(i))) { if (d0 || m == 4) break; swap; diff --git a/games/backgammon/common_source/back.h b/games/backgammon/common_source/back.h index eabf63beeb6..16a8f05435d 100644 --- a/games/backgammon/common_source/back.h +++ b/games/backgammon/common_source/back.h @@ -1,4 +1,4 @@ -/* $OpenBSD: back.h,v 1.3 1998/09/02 06:46:51 pjanzen Exp $ */ +/* $OpenBSD: back.h,v 1.4 1999/07/31 21:57:40 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -69,8 +69,8 @@ extern FILE *trace; * */ -extern char EXEC[]; /* object for main program */ -extern char TEACH[]; /* object for tutorial program */ +extern const char EXEC[]; /* object for main program */ +extern const char TEACH[]; /* object for tutorial program */ extern int pnum; /* color of player: -1 = white @@ -124,9 +124,10 @@ extern char cin[100]; /* input line of current move (used for reconstructing input after a backspace) */ -extern char *color[]; /* colors as strings */ -extern char **colorptr; /* color of current player */ -extern char **Colorptr; /* color of current player, capitalized */ +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 int colen; /* length of color of current player */ extern struct termios old, noech, raw;/* original tty status */ @@ -156,7 +157,7 @@ void fixcol __P((int, int, int, int, int)); void fixpos __P((int, int, int, int, int)); void fixtty __P((struct termios *)); void getarg __P((int, char **)); -int getcaps __P((char *)); +int getcaps __P((const char *)); void getmove __P((void)); void getout __P((int)); /* function to exit backgammon cleanly */ void gwrite __P((void)); @@ -169,22 +170,22 @@ void moverr __P((int)); int movokay __P((int)); void newpos __P((void)); void nexturn __P((void)); -void norec __P((char *)); +void norec __P((const char *)); void odds __P((int, int, int)); void proll __P((void)); int quit __P((void)); int readc __P((void)); -void recover __P((char *)); +void recover __P((const char *)); void refresh __P((void)); void roll __P((void)); int rsetbrd __P((void)); void save __P((int)); -int text __P((char **)); +int text __P((const char *const *)); void wrboard __P((void)); void wrbsub __P((void)); void wrhit __P((int)); void wrint __P((int)); void writec __P((char)); -void writel __P((char *)); +void writel __P((const char *)); void wrscore __P((void)); int yorn __P((char)); diff --git a/games/backgammon/common_source/board.c b/games/backgammon/common_source/board.c index b45321a9592..f43f8e9d338 100644 --- a/games/backgammon/common_source/board.c +++ b/games/backgammon/common_source/board.c @@ -1,4 +1,4 @@ -/* $OpenBSD: board.c,v 1.2 1998/03/19 11:13:17 pjanzen Exp $ */ +/* $OpenBSD: board.c,v 1.3 1999/07/31 21:57:40 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)board.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: board.c,v 1.2 1998/03/19 11:13:17 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: board.c,v 1.3 1999/07/31 21:57:40 pjanzen Exp $"; #endif #endif /* not lint */ @@ -50,9 +50,9 @@ void wrboard() { int l; - static char bl[] = + static const char bl[] = "| | | |\n"; - static char sv[] = + static const char sv[] = "| | | | \n"; fixtty(&noech); diff --git a/games/backgammon/common_source/check.c b/games/backgammon/common_source/check.c index d2bbce9fb2f..a5bec6c6396 100644 --- a/games/backgammon/common_source/check.c +++ b/games/backgammon/common_source/check.c @@ -1,4 +1,4 @@ -/* $OpenBSD: check.c,v 1.2 1998/03/19 11:13:18 pjanzen Exp $ */ +/* $OpenBSD: check.c,v 1.3 1999/07/31 21:57:40 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)check.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: check.c,v 1.2 1998/03/19 11:13:18 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: check.c,v 1.3 1999/07/31 21:57:40 pjanzen Exp $"; #endif #endif /* not lint */ @@ -135,7 +135,7 @@ movokay(mv) writel("Men still on bar.\n"); return(0); } - if (m = makmove(i)) { + if ((m = makmove(i))) { moverr(i); switch (m) { case 1: diff --git a/games/backgammon/common_source/fancy.c b/games/backgammon/common_source/fancy.c index fbff1ff40f9..34539f768f0 100644 --- a/games/backgammon/common_source/fancy.c +++ b/games/backgammon/common_source/fancy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fancy.c,v 1.6 1998/09/02 06:46:51 pjanzen Exp $ */ +/* $OpenBSD: fancy.c,v 1.7 1999/07/31 21:57:40 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)fancy.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: fancy.c,v 1.6 1998/09/02 06:46:51 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: fancy.c,v 1.7 1999/07/31 21:57:40 pjanzen Exp $"; #endif #endif /* not lint */ @@ -666,7 +666,7 @@ cline() int getcaps(s) - char *s; + const char *s; { char **code; /* two letter code */ char ***cap; /* pointer to cap string */ diff --git a/games/backgammon/common_source/init.c b/games/backgammon/common_source/init.c index d1da6c648d0..60e386c78d2 100644 --- a/games/backgammon/common_source/init.c +++ b/games/backgammon/common_source/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.2 1998/03/19 11:13:21 pjanzen Exp $ */ +/* $OpenBSD: init.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: init.c,v 1.2 1998/03/19 11:13:21 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: init.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $"; #endif #endif /* not lint */ @@ -53,8 +53,8 @@ FILE *trace; #endif /* name of executable object programs */ -char EXEC[] = "/usr/games/backgammon"; -char TEACH[] = "/usr/games/teachgammon"; +const char EXEC[] = "/usr/games/backgammon"; +const char TEACH[] = "/usr/games/teachgammon"; int pnum = 2; /* color of player: -1 = white @@ -73,11 +73,11 @@ int tflag = 0; /* cursor addressing flag */ int iroll = 0; /* special flag for inputting rolls */ int rfl = 0; -char *color[] = {"White", "Red", "white", "red"}; +const char *const color[] = {"White", "Red", "white", "red"}; -char **Colorptr; -char **colorptr; +const char *const *Colorptr; +const char *const *colorptr; int *inopp; int *inptr; int *offopp; diff --git a/games/backgammon/common_source/save.c b/games/backgammon/common_source/save.c index 1c65c5dd33a..17840cc74d6 100644 --- a/games/backgammon/common_source/save.c +++ b/games/backgammon/common_source/save.c @@ -1,4 +1,4 @@ -/* $OpenBSD: save.c,v 1.4 1998/08/29 23:19:09 pjanzen Exp $ */ +/* $OpenBSD: save.c,v 1.5 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,23 +37,23 @@ #if 0 static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: save.c,v 1.4 1998/08/29 23:19:09 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: save.c,v 1.5 1999/07/31 21:57:41 pjanzen Exp $"; #endif #endif /* not lint */ #include <errno.h> #include "back.h" -static char confirm[] = "Are you sure you want to leave now?"; -static char prompt[] = "Enter a file name: "; -static char exist1[] = "The file '"; -static char exist2[] = +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 '"; +static const char exist2[] = "' already exists.\nAre you sure you want to use this file?"; -static char cantuse[] = "\nCan't use "; -static char saved[] = "This game has been saved on the file '"; -static char type[] = "'.\nType \"backgammon -s "; -static char rec[] = "\" to recover your game.\n\n"; -static char cantrec[] = "Can't recover file: "; +static const char cantuse[] = "\nCan't use "; +static const char saved[] = "This game has been saved on the file '"; +static const char type[] = "'.\nType \"backgammon -s "; +static const char rec[] = "\" to recover your game.\n\n"; +static const char cantrec[] = "Can't recover file: "; void save(n) @@ -148,7 +148,7 @@ save(n) void recover(s) - char *s; + const char *s; { int fdesc; @@ -171,9 +171,9 @@ recover(s) void norec(s) - char *s; + const char *s; { - char *c; + const char *c; tflag = 0; writel(cantrec); diff --git a/games/backgammon/common_source/subs.c b/games/backgammon/common_source/subs.c index c5998f529b6..3ea1f40e25f 100644 --- a/games/backgammon/common_source/subs.c +++ b/games/backgammon/common_source/subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subs.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $ */ +/* $OpenBSD: subs.c,v 1.8 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)subs.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: subs.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: subs.c,v 1.8 1999/07/31 21:57:41 pjanzen Exp $"; #endif #endif /* not lint */ @@ -46,11 +46,11 @@ static char rcsid[] = "$OpenBSD: subs.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $" int buffnum; char outbuff[BUFSIZ]; -static char plred[] = "Player is red, computer is white."; -static char plwhite[] = "Player is white, computer is red."; -static char nocomp[] = "(No computer play.)"; +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.)"; -char *descr[] = { +const char *const descr[] = { "Usage: backgammon [-] [-nrwb] [-p [r|w|b]] [-t <term>] [-s <file>]\n", "\t-h\tget this list\n\t-n\tdon't ask for rules or instructions", "\t-r\tplayer is red (implies n)\n\t-w\tplayer is white (implies n)", @@ -134,10 +134,10 @@ writec(c) void writel(l) - char *l; + const char *l; { #ifdef DEBUG - char *s; + const char *s; if (trace == NULL) trace = fopen("bgtrace", "w"); diff --git a/games/backgammon/common_source/table.c b/games/backgammon/common_source/table.c index 5b73c31fb31..98601bd3231 100644 --- a/games/backgammon/common_source/table.c +++ b/games/backgammon/common_source/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.2 1998/03/19 11:13:27 pjanzen Exp $ */ +/* $OpenBSD: table.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,13 +37,13 @@ #if 0 static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: table.c,v 1.2 1998/03/19 11:13:27 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: table.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $"; #endif #endif /* not lint */ #include "back.h" -char *help2[] = { +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.", @@ -56,7 +56,7 @@ struct state { int newst; }; -struct state atmata[] = { +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}, diff --git a/games/backgammon/teachgammon/data.c b/games/backgammon/teachgammon/data.c index ea798118423..e333fb22d23 100644 --- a/games/backgammon/teachgammon/data.c +++ b/games/backgammon/teachgammon/data.c @@ -1,4 +1,4 @@ -/* $OpenBSD: data.c,v 1.3 1998/03/19 11:13:30 pjanzen Exp $ */ +/* $OpenBSD: data.c,v 1.4 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)data.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: data.c,v 1.3 1998/03/19 11:13:30 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: data.c,v 1.4 1999/07/31 21:57:41 pjanzen Exp $"; #endif #endif /* not lint */ @@ -46,7 +46,7 @@ static char rcsid[] = "$OpenBSD: data.c,v 1.3 1998/03/19 11:13:30 pjanzen Exp $" int maxmoves = 23; -char *text0[] = { +const char *const text0[] = { "To start the game, I roll a 3 and you roll a 1. This means", "that I get to start first. I move 8-5,6-5 since this makes a", "new point and helps to trap your back men on 1. You should be", @@ -55,7 +55,7 @@ char *text0[] = { 0 }; -char *text1[] = { +const char *const text1[] = { "Now you shall see a move using doubles. I just rolled double", "5's. I will move two men from position 13 to position 3. The", "notation for this is 13-8,13-8,8-3,8-3. You will also roll dou-", @@ -64,7 +64,7 @@ char *text1[] = { 0 }; -char *text2[] = { +const char *const text2[] = { "Excellent! As you can see, you are beginning to develop a wall", "which is trapping my men on position 24. Also, moving your back", "men forward not only improves your board position safely, but it", @@ -78,7 +78,7 @@ char *text2[] = { 0 }; -char *text3[] = { +const char *const text3[] = { "As you can see, although you left a man open, it is a rela-", "tively safe move to an advantageous position, which might help", "you make a point later. Only two rolls (4 5 or 5 4) will allow", @@ -88,14 +88,14 @@ char *text3[] = { 0 }; -char *text4[] = { +const char *const text4[] = { "You're pretty lucky yourself, you know. I follow by rolling 2 3", "and moving 25-22,24-22, forming a new point.", "", 0 }; -char *text5[] = { +const char *const text5[] = { "Not a spectacular move, but a safe one. I follow by rolling 6 1.", "I decide to use this roll to move 22-16,16-15. It leaves me with", "one man still open, but the blot is farther back on the board, and", @@ -104,7 +104,7 @@ char *text5[] = { 0 }; -char *text6[] = { +const char *const text6[] = { "By moving your two men from 17 to 20, you lessen my chance of", "getting my man off the board. In fact, the odds are 5 to 4", "against me getting off. I roll with the odds and helplessly", @@ -113,7 +113,7 @@ char *text6[] = { 0 }; -char *text7[] = { +const char *const text7[] = { "Note that the blot on 7 cannot be hit unless I get off the bar", "and have a 1 or a 6 left over, and doing so will leave two of", "my men open. Also, the blot on 16 cannot be hit at all! With", @@ -122,7 +122,7 @@ char *text7[] = { 0 }; -char *text8[] = { +const char *const text8[] = { "See, you did not get hit and, you got to `cover up' your open men.", "Quite an accomplishment. Finally, I get off the bar by rolling", "6 2 and moving 25-23,23-17.", @@ -130,14 +130,14 @@ char *text8[] = { 0 }; -char *text9[] = { +const char *const text9[] = { "My venture off the bar did not last long. However, I got lucky", "and rolled double 1's, allowing me to move 25-24,24-23,15-14,15-14.", "", 0 }; -char *text10[] = { +const char *const text10[] = { "You are improving your position greatly and safely, and are well", "on the way to winning the game. I roll a 6 2 and squeak past", "your back man. Now the game becomes a race to the finish.", @@ -145,7 +145,7 @@ char *text10[] = { 0 }; -char *text11[] = { +const char *const text11[] = { "Now that it is merely a race, you are trying to get as many men", "as possible into the inner table, so you can start removing them.", "I roll a 3 4 and move my two men farthest back to position 11", @@ -154,14 +154,14 @@ char *text11[] = { 0 }; -char *text12[] = { +const char *const text12[] = { "The race is still on, and you seem to be doing all right.", "I roll 6 1 and move 14-8,13-12.", "", 0 }; -char *text13[] = { +const char *const text13[] = { "Notice that you get to remove men the instant you have all of", "them at your inner table, even if it is the middle of a turn.", "I roll 1 2 and move 13-11,12-11.", @@ -169,7 +169,7 @@ char *text13[] = { 0 }; -char *text14[] = { +const char *const text14[] = { "Although you could have removed a man, this move illustrates two", "points: 1) You never have to remove men, and 2) You should try", "to spread out your men on your inner table. Since you have one", @@ -179,14 +179,14 @@ char *text14[] = { 0 }; -char *text15[] = { +const char *const text15[] = { "This time you were able to remove men. I roll 3 4 and move", "11-7,11-8. The race continues.", "", 0 }; -char *text16[] = { +const char *const text16[] = { "More holes are opening up in your inner table, but you are", "still very much ahead. If we were doubling, you would have", "doubled long ago. I roll 2 6 and move 8-6,11-5.", @@ -194,13 +194,13 @@ char *text16[] = { 0 }; -char *text17[] = { +const char *const text17[] = { "It pays to spread out your men. I roll 3 5 and move 7-4,8-3.", "", 0 }; -char *text18[] = { +const char *const text18[] = { "You can only remove some men, but you spread out more and", "more, in order to be able to remove men more efficiently.", "I roll double 3's, which help, but not that much. I move", @@ -209,34 +209,34 @@ char *text18[] = { 0 }; -char *text19[] = { +const char *const text19[] = { "I roll 1 4 and move 5-4,4-0.", "", 0 }; -char *text20[] = { +const char *const text20[] = { "You are now nicely spread out to win a game. I roll 5 6 and", "move 5-0,6-0.", "", 0 }; -char *text21[] = { +const char *const text21[] = { "Any minute now. Just a few short steps from victory. I roll", "2 4 and move 6-4,4-0.", "", 0 }; -char *text22[] = { +const char *const text22[] = { "It looks pretty hopeless for me, but I play on, rolling 1 3 and", "moving 4-3,3-0.", "", 0 }; -char *text23[] = { +const char *const text23[] = { "Congratulations! You just won a game of backgammon against the", "computer! This ends the tutorial; next is a real game. Remember", "when you start playing that doubling will be enabled, which", @@ -245,13 +245,13 @@ char *text23[] = { 0 }; -char *ans0[] = { +const char *const ans0[] = { "Never seen", "", 0 }; -char *ans1[] = { +const char *const ans1[] = { "No, that's still not it. Here's the move that you should have made:", "17/4,19/2. That makes a new point at position 21. I will make the", "move for you now, and continue with my own move after that.", @@ -259,142 +259,142 @@ char *ans1[] = { 0 }; -char *ans2[] = { +const char *const ans2[] = { "Okay, I'll tell you the move that I consider best: 1/66,12/66. All", "points, no blots. I'll make that move now and continue on.", "", 0 }; -char *ans3[] = { +const char *const ans3[] = { "That's not it. The move I will make for you is 12-14-15.", "", 0 }; -char *ans4[] = { +const char *const ans4[] = { "It's clear that the only move you can do is 0-2-7.", "", 0 }; -char *ans5[] = { +const char *const ans5[] = { "Not optimal. Your best move is 7-11-12.", "", 0 }; -char *ans6[] = { +const char *const ans6[] = { "There are many passable moves, but the best is 17/33,19/33, which", "I will do for you now.", "", 0 }; -char *ans7[] = { +const char *const ans7[] = { "That's still not the move I consider best. I'll force you to play", "7/5,12/4 and justify it later.", "", 0 }; -char *ans8[] = { +const char *const ans8[] = { "No. It's pretty clear that 7-10-16, which removes your blots, is best.", "", 0 }; -char *ans9[] = { +const char *const ans9[] = { "No. Why not 12-17-18?", "", 0 }; -char *ans10[] = { +const char *const ans10[] = { "No. Your best move is 12/46.", "", 0 }; -char *ans11[] = { +const char *const ans11[] = { "No. Your best move is 16/3,18/1.", "", 0 }; -char *ans12[] = { +const char *const ans12[] = { "No. Your best move is 16/35.", "", 0 }; -char *ans13[] = { +const char *const ans13[] = { "No. Your best move is 18/444,21/4.", "", 0 }; -char *ans14[] = { +const char *const ans14[] = { "No. Your best move is 22/12.", "", 0 }; -char *ans15[] = { +const char *const ans15[] = { "No. Your best move is 19-H,22-H.", "", 0 }; -char *ans16[] = { +const char *const ans16[] = { "No. Your best move is 20/5,23/2.", "", 0 }; -char *ans17[] = { +const char *const ans17[] = { "No. Your best move is 19-H,24-H.", "", 0 }; -char *ans18[] = { +const char *const ans18[] = { "No. I think your best move is 20/5,21/2. I'll move that now.", "", 0 }; -char *ans19[] = { +const char *const ans19[] = { "No. Your best move is 19/16.", "", 0 }; -char *ans20[] = { +const char *const ans20[] = { "No. Your best move is 22/3,23/2.", "", 0 }; -char *ans21[] = { +const char *const ans21[] = { "No. Your best move is 20/1,21-H.", "", 0 }; -char *ans22[] = { +const char *const ans22[] = { "No. Your best move is 19-H,21-23.", "", 0 }; -char *ans23[] = { +const char *const ans23[] = { "No. Your best move is 22-H,23-H.", "", 0 }; -struct situatn test[] = { +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}, {ans0} diff --git a/games/backgammon/teachgammon/teach.c b/games/backgammon/teachgammon/teach.c index 3531a04db28..62187dd19a5 100644 --- a/games/backgammon/teachgammon/teach.c +++ b/games/backgammon/teachgammon/teach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: teach.c,v 1.5 1998/08/29 23:19:12 pjanzen Exp $ */ +/* $OpenBSD: teach.c,v 1.6 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: teach.c,v 1.5 1998/08/29 23:19:12 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: teach.c,v 1.6 1999/07/31 21:57:41 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +52,7 @@ static char rcsid[] = "$OpenBSD: teach.c,v 1.5 1998/08/29 23:19:12 pjanzen Exp $ extern speed_t ospeed; /* tty output speed for termlib */ -char *helpm[] = { +const char *const helpm[] = { "\nEnter a space or newline to roll, or", " b to display the board", " d to double", @@ -60,7 +60,7 @@ char *helpm[] = { 0 }; -char *contin[] = { +const char *const contin[] = { "", 0 }; @@ -104,42 +104,42 @@ main(argc, argv) break; case 2: - if (i = text(intro1)) + if ((i = text(intro1))) break; wrboard(); - if (i = text(intro2)) + if ((i = text(intro2))) break; case 3: - if (i = text(moves)) + if ((i = text(moves))) break; case 4: - if (i = text(removepiece)) + if ((i = text(removepiece))) break; case 5: - if (i = text(hits)) + if ((i = text(hits))) break; case 6: - if (i = text(endgame)) + if ((i = text(endgame))) break; case 7: - if (i = text(doubl)) + if ((i = text(doubl))) break; case 8: - if (i = text(stragy)) + if ((i = text(stragy))) break; case 9: - if (i = text(prog)) + if ((i = text(prog))) break; case 10: - if (i = text(lastch)) + if ((i = text(lastch))) break; } tutor(); @@ -154,7 +154,7 @@ leave() else writec('\n'); fixtty(&old); - execl(EXEC, "backgammon", args, "n", 0); + execl(EXEC, "backgammon", "-n", args, 0); writel("Help! Backgammon program is missing\007!!\n"); exit(-1); } diff --git a/games/backgammon/teachgammon/ttext1.c b/games/backgammon/teachgammon/ttext1.c index 1fb7339a788..4df56854144 100644 --- a/games/backgammon/teachgammon/ttext1.c +++ b/games/backgammon/teachgammon/ttext1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttext1.c,v 1.2 1998/03/19 11:13:33 pjanzen Exp $ */ +/* $OpenBSD: ttext1.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,17 +37,17 @@ #if 0 static char sccsid[] = "@(#)ttext1.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: ttext1.c,v 1.2 1998/03/19 11:13:33 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: ttext1.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $"; #endif #endif /* not lint */ #include "back.h" #include "tutor.h" -char *opts = " QIMRHEDSPT"; -char *prompt = "-->"; +const char *const opts = " QIMRHEDSPT"; +const char *const prompt = "-->"; -char *list[] = { +const char *const list[] = { "\n\n\tI\tIntroduction to Backgammon", "\tM\tMoves and Points", "\tR\tRemoving Men from the Board", @@ -63,7 +63,7 @@ char *list[] = { 0 }; -char *hello[] = { +const char *const hello[] = { "\n This introduction is comprised of text describing how to play", "Backgammon followed by a tutorial session where you play a practice", "game against the computer. When using this program, think carefully", @@ -79,7 +79,7 @@ char *hello[] = { 0 }; -char *intro1[] = { +const char *const intro1[] = { "\nIntroduction:", "\n Backgammon is a game involving the skill of two players and", "the luck of two dice. Both of the two players, red and white,", @@ -90,7 +90,7 @@ char *intro1[] = { "", 0}; -char *intro2[] = { +const char *const intro2[] = { "", "\n Although they are not shown on the board, the players' homes are", "located just to the right of the board. A player's men are placed", @@ -104,7 +104,7 @@ char *intro2[] = { "", 0}; -char *moves[] = { +const char *const moves[] = { "\nMoves and Points:", "\n Moves are made along the positions on the board according to", "their numbers. Red moves in the positive direction (clockwise from", @@ -134,7 +134,7 @@ char *moves[] = { "", 0}; -char *removepiece[] = { +const char *const removepiece[] = { "\nRemoving Men from the Board:", "\n The most important part of the game is removing men, since", "that is how you win the game. Once a man is removed, he stays", @@ -157,7 +157,7 @@ char *removepiece[] = { "", 0}; -char *hits[] = { +const char *const hits[] = { "\nHitting Blots:", "\n Although two men on a position form an impenetrable point, a", "lone man is not so secure. Such a man is called a 'blot' and has", @@ -175,7 +175,7 @@ char *hits[] = { "", 0}; -char *endgame[] = { +const char *const endgame[] = { "\nEnding the Game and Scoring:", "\n Winning a game usually wins one point, the normal value of a", "game. However, if the losing player has not removed any men yet,", diff --git a/games/backgammon/teachgammon/ttext2.c b/games/backgammon/teachgammon/ttext2.c index 6c6a6e312bf..952ed0d1620 100644 --- a/games/backgammon/teachgammon/ttext2.c +++ b/games/backgammon/teachgammon/ttext2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttext2.c,v 1.2 1998/03/19 11:13:34 pjanzen Exp $ */ +/* $OpenBSD: ttext2.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,14 +37,14 @@ #if 0 static char sccsid[] = "@(#)ttext2.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: ttext2.c,v 1.2 1998/03/19 11:13:34 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: ttext2.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $"; #endif #endif /* not lint */ #include "back.h" #include "tutor.h" -char *doubl[] = { +const char *const doubl[] = { "\nDoubling:", "\n If a player thinks he is in a good position, he may double the", "value of the game. However, his opponent may not accept the proposal", @@ -59,7 +59,7 @@ char *doubl[] = { "", 0}; -char *stragy[] = { +const char *const stragy[] = { "\nStrategy:", "\n Some general hints when playing: Try not to leave men open:", "it is good to make as many points as possible. Often, two men", @@ -75,7 +75,7 @@ char *stragy[] = { "", 0}; -char *prog[] = { +const char *const prog[] = { "\nThe Program and How It Works:", "\n A general rule of thumb is to type a question mark if you", "don't know what to do: you should get some help. When it is your", @@ -107,7 +107,7 @@ char *prog[] = { "", 0}; -char *lastch[] = { +const char *const lastch[] = { "\nTutorial (Practice Game):", "\n This tutorial, for simplicity's sake, will let you play one", "predetermined game. All the rolls have been pre-arranged, and", @@ -127,12 +127,12 @@ char *lastch[] = { int text(txt) - char **txt; + const char *const *txt; { - char **begin; - char *a; + const char *const *begin; + const char *a; char b; - char *c; + const char *c; int i; fixtty(&noech); diff --git a/games/backgammon/teachgammon/tutor.c b/games/backgammon/teachgammon/tutor.c index 67e6b5ee609..885f7e6402b 100644 --- a/games/backgammon/teachgammon/tutor.c +++ b/games/backgammon/teachgammon/tutor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tutor.c,v 1.2 1998/03/19 11:13:35 pjanzen Exp $ */ +/* $OpenBSD: tutor.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,14 +37,14 @@ #if 0 static char sccsid[] = "@(#)tutor.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: tutor.c,v 1.2 1998/03/19 11:13:35 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: tutor.c,v 1.3 1999/07/31 21:57:41 pjanzen Exp $"; #endif #endif /* not lint */ #include "back.h" #include "tutor.h" -static 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() @@ -171,9 +171,9 @@ clrest() int brdeq(b1, b2) - int *b1, *b2; + const int *b1, *b2; { - int *e; + const int *e; e = b1 + 26; while (b1 < e) diff --git a/games/backgammon/teachgammon/tutor.h b/games/backgammon/teachgammon/tutor.h index df3130298b6..b031e25f93a 100644 --- a/games/backgammon/teachgammon/tutor.h +++ b/games/backgammon/teachgammon/tutor.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tutor.h,v 1.2 1998/03/19 11:13:37 pjanzen Exp $ */ +/* $OpenBSD: tutor.h,v 1.3 1999/07/31 21:57:41 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,29 +43,29 @@ struct situatn { int mg[4]; int new1; int new2; - char *(*com[8]); - char *(*ans[8]); + const char *const (*com[8]); + const char *const (*ans[8]); }; -extern char *doubl[]; -extern char *endgame[]; -extern char *hello[]; -extern char *hits[]; -extern char *intro1[]; -extern char *intro2[]; -extern char *lastch[]; -extern char *list[]; -extern int maxmoves; -extern char *moves[]; -extern char *opts; -extern char *prog[]; -extern char *prompt; -extern char *removepiece[]; -extern char *stragy[]; -extern struct situatn test[]; +extern const char *const doubl[]; +extern const char *const endgame[]; +extern const char *const hello[]; +extern const char *const hits[]; +extern const char *const intro1[]; +extern const char *const intro2[]; +extern const char *const lastch[]; +extern const char *const list[]; +extern int maxmoves; +extern const char *const moves[]; +extern const char *const opts; +extern const char *const prog[]; +extern const char *const prompt; +extern const char *const removepiece[]; +extern const char *const stragy[]; +extern const struct situatn test[]; -int brdeq __P((int *, int *)); +int brdeq __P((const int *, const int *)); void clrest __P((void)); void leave __P((void)); void tutor __P((void)); |