Subject: bin/6580: [PATCH] Backgammon: patch to use const
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm28@cam.ac.uk>
List: netbsd-bugs
Date: 12/14/1998 17:49:47
>Number: 6580
>Category: bin
>Synopsis: [PATCH] Backgammon: patch to use const
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Dec 14 10:20:01 1998
>Last-Modified:
>Originator: Joseph S. Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release: NetBSD-current of 1998-12-07
>Environment:
[
System: Linux decomino 2.0.36 #1 Mon Nov 16 14:25:34 UTC 1998 i686 unknown
Architecture: i686
]
>Description:
The patch below makes the game backgammon(6) use `const' where
appropriate. It also removes some obsolete, unused code to check the
number of users on the system (obsoleted by dm); removes a prototype
for an unused function that was removed earlier; and removes a control
character from one message that was I think intended to clear the
screen on some particular terminal (though I can't find the comment to
that effect in any of the BSD source trees I have handy) but no longer
serves any useful purpose.
>How-To-Repeat:
>Fix:
diff -ruN backgammon/backgammon/main.c backgammon+/backgammon/main.c
--- backgammon/backgammon/main.c Wed Sep 16 11:05:07 1998
+++ backgammon+/backgammon/main.c Mon Dec 14 17:17:56 1998
@@ -51,53 +51,42 @@
#include "backlocal.h"
#define MVPAUSE 5 /* time to sleep when stuck */
-#define MAXUSERS 35 /* maximum number of users */
-extern char *instr[]; /* text of instructions */
-extern char *message[]; /* update message */
+extern const char *const instr[]; /* text of instructions */
+extern const char *const message[]; /* update message */
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
};
-#if 0
-static char user1a[] =
-"Sorry, you cannot play backgammon when there are more than ";
-static char user1b[] =
-" users\non the system.";
-static char user2a[] =
-"\nThere are now more than ";
-static char user2b[] =
-" users on the system, so you cannot play\nanother game. ";
-#endif
-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?";
-static char password[] = "losfurng";
+static const char password[] = "losfurng";
static char pbuf[10];
int
@@ -121,16 +110,6 @@
raw.c_lflag &= ~ICANON; /* set up modes */
ospeed = cfgetospeed(&old); /* for termlib */
- /* check user count */
-#ifdef CORY
- if (ucount() > MAXUSERS) {
- writel(user1a);
- wrint(MAXUSERS);
- writel(user1b);
- getout(0);
- }
-#endif
-
/* get terminal capabilities, and decide if it can cursor address */
tflag = getcaps(getenv("TERM"));
/* use whole screen for text */
@@ -518,17 +497,6 @@
/* write score */
wrscore();
-
- /* check user count */
-#ifdef CORY
- if (ucount() > MAXUSERS) {
- writel(user2a);
- wrint(MAXUSERS);
- writel(user2b);
- rfl = 1;
- break;
- }
-#endif
/* see if he wants another game */
writel(again);
diff -ruN backgammon/backgammon/text.c backgammon+/backgammon/text.c
--- backgammon/backgammon/text.c Fri Oct 10 11:21:59 1997
+++ backgammon+/backgammon/text.c Mon Dec 14 16:59:53 1998
@@ -44,7 +44,7 @@
#include "back.h"
-char *instr[] = {
+const char *const instr[] = {
" If you did not notice by now, this program reacts to things as",
"soon as you type them, without waiting for a newline. This means that",
"the special characters RUBOUT, ESC, and CONTROL-D, will not perform",
@@ -112,10 +112,10 @@
int
text(t)
- char **t;
+ const char *const *t;
{
int i;
- char *s, *a;
+ const char *s, *a;
fixtty(&noech);
while (*t != 0) {
diff -ruN backgammon/backgammon/version.c backgammon+/backgammon/version.c
--- backgammon/backgammon/version.c Fri Oct 10 11:21:59 1997
+++ backgammon+/backgammon/version.c Mon Dec 14 17:00:02 1998
@@ -42,7 +42,7 @@
#endif
#endif /* not lint */
-char *message[] = {
+const char *const message[] = {
"Last updated on Friday, October 10, 1997.",
0
};
diff -ruN backgammon/common_source/back.h backgammon+/common_source/back.h
--- backgammon/common_source/back.h Mon Sep 14 11:04:48 1998
+++ backgammon+/common_source/back.h Mon Dec 14 17:02:32 1998
@@ -65,8 +65,8 @@
*
*/
-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
@@ -120,10 +120,10 @@
(used for reconstructing input after
a backspace) */
-extern char *color[];
+extern const char *const color[];
/* colors as strings */
-extern char **colorptr; /* color of current player */
-extern char **Colorptr; /* color of current player, capitalized */
+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 */
@@ -153,7 +153,7 @@
void fixpos __P((int, int, int, int, int));
void fixtty __P((struct termios *));
void getarg __P((char ***));
-int getcaps __P((char *));
+int getcaps __P((const char *));
void getmove __P((void));
void getout __P((int)) __attribute__((__noreturn__));
void gwrite __P((void));
@@ -168,23 +168,22 @@
void newline __P((void));
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 **));
-void tos __P((void));
+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 -ruN backgammon/common_source/board.c backgammon+/common_source/board.c
--- backgammon/common_source/board.c Fri Oct 10 11:22:07 1997
+++ backgammon+/common_source/board.c Mon Dec 14 17:03:03 1998
@@ -51,9 +51,9 @@
wrboard()
{
int l;
- static char bl[] =
+ static const char bl[] =
"| | | |\n";
- static char sv[] =
+ static const char sv[] =
"| | | | \n";
fixtty(&noech);
diff -ruN backgammon/common_source/fancy.c backgammon+/common_source/fancy.c
--- backgammon/common_source/fancy.c Mon Sep 14 11:04:49 1998
+++ backgammon+/common_source/fancy.c Mon Dec 14 17:03:22 1998
@@ -691,7 +691,7 @@
int
getcaps(s)
- char *s;
+ const char *s;
{
char *code; /* two letter code */
char ***cap; /* pointer to cap string */
diff -ruN backgammon/common_source/init.c backgammon+/common_source/init.c
--- backgammon/common_source/init.c Tue Oct 14 11:09:12 1997
+++ backgammon+/common_source/init.c Mon Dec 14 17:03:55 1998
@@ -49,8 +49,8 @@
*/
/* 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 1 = red 0 =
* both 2 = not yet init'ed */
@@ -66,11 +66,11 @@
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 -ruN backgammon/common_source/save.c backgammon+/common_source/save.c
--- backgammon/common_source/save.c Mon Sep 14 11:04:49 1998
+++ backgammon+/common_source/save.c Mon Dec 14 17:05:35 1998
@@ -46,16 +46,16 @@
#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 ";
-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 ";
+static const char rec[] = "\" to recover your game.\n\n";
+static const char cantrec[] = "Can't recover file: ";
void
save(n)
@@ -150,7 +150,7 @@
void
recover(s)
- char *s;
+ const char *s;
{
int fdesc;
@@ -173,9 +173,9 @@
void
norec(s)
- char *s;
+ const char *s;
{
- char *c;
+ const char *c;
tflag = 0;
writel(cantrec);
diff -ruN backgammon/common_source/subs.c backgammon+/common_source/subs.c
--- backgammon/common_source/subs.c Wed Sep 16 11:05:07 1998
+++ backgammon+/common_source/subs.c Mon Dec 14 17:06:26 1998
@@ -47,11 +47,11 @@
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 [-] [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)",
@@ -136,10 +136,10 @@
void
writel(l)
- char *l;
+ const char *l;
{
#ifdef DEBUG
- char *s;
+ const char *s;
if (trace == NULL)
trace = fopen("bgtrace", "w");
diff -ruN backgammon/common_source/table.c backgammon+/common_source/table.c
--- backgammon/common_source/table.c Fri Oct 10 11:22:14 1997
+++ backgammon+/common_source/table.c Mon Dec 14 17:06:48 1998
@@ -44,7 +44,7 @@
#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.",
@@ -57,7 +57,7 @@
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 -ruN backgammon/teachgammon/data.c backgammon+/teachgammon/data.c
--- backgammon/teachgammon/data.c Fri Oct 10 11:22:16 1997
+++ backgammon+/teachgammon/data.c Mon Dec 14 17:09:10 1998
@@ -46,7 +46,7 @@
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",
@@ -54,7 +54,7 @@
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-",
@@ -62,7 +62,7 @@
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",
@@ -75,7 +75,7 @@
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",
@@ -84,13 +84,13 @@
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-17. It leaves me with",
"one man still open, but the blot is farther back on the board, and",
@@ -98,7 +98,7 @@
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",
@@ -106,7 +106,7 @@
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",
@@ -114,27 +114,27 @@
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.",
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 0-1,1-2,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.",
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",
@@ -142,20 +142,20 @@
0
};
-char *text12[] = {
+const char *const text12[] = {
"The race is still on, and you have 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.",
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",
@@ -164,25 +164,25 @@
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.",
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",
@@ -190,30 +190,30 @@
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! You will now be able to play a game, but remember,",
"when you start playing, that doubling will be enabled, which",
@@ -222,7 +222,7 @@
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},
diff -ruN backgammon/teachgammon/teach.c backgammon+/teachgammon/teach.c
--- backgammon/teachgammon/teach.c Wed Sep 16 11:05:07 1998
+++ backgammon+/teachgammon/teach.c Mon Dec 14 17:09:31 1998
@@ -52,7 +52,7 @@
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 @@
0
};
-char *contin[] = {
+const char *const contin[] = {
"",
0
};
diff -ruN backgammon/teachgammon/ttext1.c backgammon+/teachgammon/ttext1.c
--- backgammon/teachgammon/ttext1.c Fri Oct 10 11:22:18 1997
+++ backgammon+/teachgammon/ttext1.c Mon Dec 14 17:11:04 1998
@@ -45,10 +45,10 @@
#include "back.h"
#include "tutor.h"
-char *opts = " QIMRHEDSPT";
-char *prompt = "-->";
+const char *opts = " QIMRHEDSPT";
+const char *prompt = "-->";
-char *list[] = {
+const char *const list[] = {
"\n\n\tI\tIntroduction to Backgammon",
"\tM\tMoves and Points",
"\tR\tRemoving Men from the Board",
@@ -64,8 +64,8 @@
0
};
-char *hello[] = {
- "\n\032 These rules consist of text describing how to play Backgammon",
+const char *const hello[] = {
+ "\n These rules consist 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 carefuly",
"before typing, since it reacts as soon as you type something. In",
@@ -82,7 +82,7 @@
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. There are two players, red and white, and",
@@ -93,7 +93,7 @@
"",
0};
-char *intro2[] = {
+const char *const intro2[] = {
"",
"\n Although not indicated on the board, the players' homes are",
"located just to the right of the board. A player's men are placed",
@@ -107,7 +107,7 @@
"",
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",
@@ -138,7 +138,7 @@
"",
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",
@@ -162,7 +162,7 @@
"",
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",
@@ -179,7 +179,7 @@
"",
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 -ruN backgammon/teachgammon/ttext2.c backgammon+/teachgammon/ttext2.c
--- backgammon/teachgammon/ttext2.c Fri Oct 10 11:22:23 1997
+++ backgammon+/teachgammon/ttext2.c Mon Dec 14 17:12:08 1998
@@ -45,7 +45,7 @@
#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 pro-",
@@ -60,7 +60,7 @@
"",
0};
-char *stragy[] = {
+const char *const stragy[] = {
"\nStrategy:",
"\n Some general hints when playing: Try not to leave men open",
"unless absolutely necessary. Also, it is good to make as many",
@@ -76,7 +76,7 @@
"",
0};
-char *prog[] = {
+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,",
"type a question mark, and you should get some help. When it is",
@@ -110,7 +110,7 @@
"",
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",
@@ -132,12 +132,12 @@
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 -ruN backgammon/teachgammon/tutor.c backgammon+/teachgammon/tutor.c
--- backgammon/teachgammon/tutor.c Fri Oct 10 11:22:23 1997
+++ backgammon+/teachgammon/tutor.c Mon Dec 14 17:12:25 1998
@@ -45,7 +45,7 @@
#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()
@@ -148,9 +148,9 @@
int
brdeq(b1, b2)
- int *b1, *b2;
+ const int *b1, *b2;
{
- int *e;
+ const int *e;
e = b1 + 26;
while (b1 < e)
diff -ruN backgammon/teachgammon/tutor.h backgammon+/teachgammon/tutor.h
--- backgammon/teachgammon/tutor.h Mon Sep 14 11:04:49 1998
+++ backgammon+/teachgammon/tutor.h Mon Dec 14 17:14:28 1998
@@ -47,26 +47,26 @@
};
-extern char *doubl[];
-extern char *endgame[];
-extern char *finis[];
-extern char *hello[];
-extern char *hits[];
-extern char *intro1[];
-extern char *intro2[];
-extern char *lastch[];
-extern char *list[];
+extern const char *const doubl[];
+extern const char *const endgame[];
+extern const char *const finis[];
+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 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 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)) __attribute__((__noreturn__));
void tutor __P((void)) __attribute__((__noreturn__));
>Audit-Trail:
>Unformatted: