summaryrefslogtreecommitdiffstats
path: root/monop
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
committerjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
commit04f4d7044367099914cf1906ae27ac20c24e44cf (patch)
treec17cb5c2f270bbb70eeba18cbe2bcfa43cfd8e10 /monop
parentf9706028dd6e2afabb6bd63d02d7bc90f78e4aab (diff)
downloadbsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.gz
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.zst
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.zip
Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the NetBSD games, except in hunt (where substantial changes from OpenBSD need to be looked at). Some such changes were previously covered in PRs bin/6041, bin/6146, bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994, bin/8039, bin/8057 and bin/8093.
Diffstat (limited to 'monop')
-rw-r--r--monop/cards.c8
-rw-r--r--monop/execute.c6
-rw-r--r--monop/getinp.c13
-rw-r--r--monop/houses.c8
-rw-r--r--monop/initdeck.c8
-rw-r--r--monop/misc.c8
-rw-r--r--monop/monop.def12
-rw-r--r--monop/monop.ext6
-rw-r--r--monop/monop.h18
-rw-r--r--monop/morg.c8
-rw-r--r--monop/print.c10
-rw-r--r--monop/spec.c6
-rw-r--r--monop/trade.c6
13 files changed, 59 insertions, 58 deletions
diff --git a/monop/cards.c b/monop/cards.c
index fc7bde48..489f25ee 100644
--- a/monop/cards.c
+++ b/monop/cards.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cards.c,v 1.7 1999/08/21 10:40:03 simonb Exp $ */
+/* $NetBSD: cards.c,v 1.8 1999/09/08 21:17:51 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: cards.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
+__RCSID("$NetBSD: cards.c,v 1.8 1999/09/08 21:17:51 jsm Exp $");
#endif
#endif /* not lint */
@@ -54,9 +54,9 @@ __RCSID("$NetBSD: cards.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
#define GOJF 'F' /* char for get-out-of-jail-free cards */
#ifndef DEV
-static char *cardfile = _PATH_CARDS;
+static const char *cardfile = _PATH_CARDS;
#else
-static char *cardfile = "cards.pck";
+static const char *cardfile = "cards.pck";
#endif
static FILE *deckf;
diff --git a/monop/execute.c b/monop/execute.c
index 505bbc4e..42f23797 100644
--- a/monop/execute.c
+++ b/monop/execute.c
@@ -1,4 +1,4 @@
-/* $NetBSD: execute.c,v 1.6 1999/08/21 10:40:03 simonb Exp $ */
+/* $NetBSD: execute.c,v 1.7 1999/09/08 21:17:51 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)execute.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: execute.c,v 1.6 1999/08/21 10:40:03 simonb Exp $");
+__RCSID("$NetBSD: execute.c,v 1.7 1999/09/08 21:17:51 jsm Exp $");
#endif
#endif /* not lint */
@@ -240,7 +240,7 @@ restore()
*/
int
rest_f(file)
- char *file;
+ const char *file;
{
char *sp;
int inf, num;
diff --git a/monop/getinp.c b/monop/getinp.c
index 84d4548c..8976ba2f 100644
--- a/monop/getinp.c
+++ b/monop/getinp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: getinp.c,v 1.7 1999/08/21 10:40:03 simonb Exp $ */
+/* $NetBSD: getinp.c,v 1.8 1999/09/08 21:17:51 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getinp.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: getinp.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
+__RCSID("$NetBSD: getinp.c,v 1.8 1999/09/08 21:17:51 jsm Exp $");
#endif
#endif /* not lint */
@@ -51,11 +51,11 @@ __RCSID("$NetBSD: getinp.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
static char buf[257];
-static int comp __P((char *));
+static int comp __P((const char *));
int
getinp(prompt, list)
- char *prompt, *list[];
+ const char *prompt, *const list[];
{
int i, n_match, match = 0;
char *sp;
@@ -112,9 +112,10 @@ inter:
static int
comp(s1)
- char *s1;
+ const char *s1;
{
- char *sp, *tsp, c;
+ const char *sp, *tsp;
+ char c;
if (buf[0] != '\0')
for (sp = buf, tsp = s1; *sp; ) {
diff --git a/monop/houses.c b/monop/houses.c
index 79a9703d..27dacc72 100644
--- a/monop/houses.c
+++ b/monop/houses.c
@@ -1,4 +1,4 @@
-/* $NetBSD: houses.c,v 1.5 1999/08/21 10:40:03 simonb Exp $ */
+/* $NetBSD: houses.c,v 1.6 1999/09/08 21:17:51 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,14 +38,14 @@
#if 0
static char sccsid[] = "@(#)houses.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: houses.c,v 1.5 1999/08/21 10:40:03 simonb Exp $");
+__RCSID("$NetBSD: houses.c,v 1.6 1999/09/08 21:17:51 jsm Exp $");
#endif
#endif /* not lint */
#include "monop.ext"
-static char *names[N_MON+2],
- cur_prop[80];
+static const char *names[N_MON+2];
+static char cur_prop[80];
static MON *monops[N_MON];
diff --git a/monop/initdeck.c b/monop/initdeck.c
index 9474f43d..99b2fb2a 100644
--- a/monop/initdeck.c
+++ b/monop/initdeck.c
@@ -1,4 +1,4 @@
-/* $NetBSD: initdeck.c,v 1.7 1999/08/21 10:40:03 simonb Exp $ */
+/* $NetBSD: initdeck.c,v 1.8 1999/09/08 21:17:52 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)initdeck.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: initdeck.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
+__RCSID("$NetBSD: initdeck.c,v 1.8 1999/09/08 21:17:52 jsm Exp $");
#endif
#endif /* not lint */
@@ -69,8 +69,8 @@ __RCSID("$NetBSD: initdeck.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
#define bool char
-char *infile = "cards.inp", /* input file */
- *outfile = "cards.pck"; /* "packed" file */
+const char *infile = "cards.inp", /* input file */
+ *outfile = "cards.pck"; /* "packed" file */
DECK deck[2];
diff --git a/monop/misc.c b/monop/misc.c
index f659cac1..14fb4ca7 100644
--- a/monop/misc.c
+++ b/monop/misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.7 1999/08/21 10:40:03 simonb Exp $ */
+/* $NetBSD: misc.c,v 1.8 1999/09/08 21:17:52 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: misc.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
+__RCSID("$NetBSD: misc.c,v 1.8 1999/09/08 21:17:52 jsm Exp $");
#endif
#endif /* not lint */
@@ -52,7 +52,7 @@ __RCSID("$NetBSD: misc.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
*/
int
getyn(prompt)
- char *prompt;
+ const char *prompt;
{
int com;
@@ -96,7 +96,7 @@ next_play()
*/
int
get_int(prompt)
- char *prompt;
+ const char *prompt;
{
int num;
char *sp;
diff --git a/monop/monop.def b/monop/monop.def
index 08700bb2..4bca6372 100644
--- a/monop/monop.def
+++ b/monop/monop.def
@@ -1,4 +1,4 @@
-/* $NetBSD: monop.def,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
+/* $NetBSD: monop.def,v 1.6 1999/09/08 21:17:52 jsm Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -43,8 +43,8 @@ bool fixing, /* set if fixing up debt */
told_em, /* set if told user he's out of debt */
spec; /* set if moving by card to RR or UTIL */
-char *name_list[MAX_PL+2], /* list of players' names */
- *comlist[] = { /* list of normal commands */
+const char *name_list[MAX_PL+2], /* list of players' names */
+ *const comlist[] = { /* list of normal commands */
"quit", /* 0 */ "print", /* 1 */
"where", /* 2 */ "own holdings", /* 3 */
"holdings", /* 4 */ "mortgage", /* 5 */
@@ -56,14 +56,14 @@ char *name_list[MAX_PL+2], /* list of players' names */
"", /* 16 */
0
},
- *yn[] = { /* list of commands for yes/no answers */
+ *const yn[] = { /* list of commands for yes/no answers */
"yes", /* 0 */ "no", /* 1 */
"quit", /* 2 */ "print", /* 3 */
"where", /* 4 */ "own holdings", /* 5 */
"holdings", /* 6 */
0
},
- *lucky_mes[] = { /* "got lucky" messages */
+ *const lucky_mes[] = { /* "got lucky" messages */
"You lucky stiff", "You got lucky",
"What a lucky person!", "You must have a 4-leaf clover",
"My, my! Aren't we lucky!", "Luck smiles upon you",
@@ -80,7 +80,7 @@ int player, /* current player number */
num_luck = sizeof lucky_mes / sizeof (char *);
/* list of command functions */
-void (*func[]) __P((void)) = { /* array of function calls for commands */
+void (*const func[]) __P((void)) = { /* array of function calls for commands */
quit, /* quit game |* 0 *| */
printboard, /* print board |* 1 *| */
where, /* where players are |* 2 *| */
diff --git a/monop/monop.ext b/monop/monop.ext
index a83fee42..5903f3d9 100644
--- a/monop/monop.ext
+++ b/monop/monop.ext
@@ -1,4 +1,4 @@
-/* $NetBSD: monop.ext,v 1.3 1997/10/12 17:45:19 christos Exp $ */
+/* $NetBSD: monop.ext,v 1.4 1999/09/08 21:17:52 jsm Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -40,11 +40,11 @@
extern bool trading, spec, fixing, told_em;
-extern char *yn[], *comlist[], *name_list[], *lucky_mes[];
+extern const char *const yn[], *const comlist[], *name_list[], *const lucky_mes[];
extern int num_play, player, num_doub, num_luck;
-extern void (*func[]) __P((void));
+extern void (*const func[]) __P((void));
extern DECK deck[2];
diff --git a/monop/monop.h b/monop/monop.h
index 4618cefa..98db7e02 100644
--- a/monop/monop.h
+++ b/monop/monop.h
@@ -1,4 +1,4 @@
-/* $NetBSD: monop.h,v 1.7 1999/08/21 10:40:04 simonb Exp $ */
+/* $NetBSD: monop.h,v 1.8 1999/09/08 21:17:52 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -76,7 +76,7 @@
}
struct sqr_st { /* structure for square */
- char *name; /* place name */
+ const char *name; /* place name */
short owner; /* owner number */
short type; /* place type */
struct prp_st *desc; /* description struct */
@@ -86,13 +86,13 @@ struct sqr_st { /* structure for square */
typedef struct sqr_st SQUARE;
struct mon_st { /* monopoly description structure */
- char *name; /* monop. name (color) */
+ const char *name; /* monop. name (color) */
short owner; /* owner of monopoly */
short num_in; /* # in monopoly */
short num_own; /* # owned (-1: not poss. monop)*/
short h_cost; /* price of houses */
- char *not_m; /* name if not monopoly */
- char *mon_n; /* name if a monopoly */
+ const char *not_m; /* name if not monopoly */
+ const char *mon_n; /* name if a monopoly */
unsigned char sqnums[3]; /* Square numbers (used to init)*/
SQUARE *sq[3]; /* list of squares in monop */
};
@@ -146,10 +146,10 @@ void do_move __P((void));
void move __P((int));
void save __P((void));
void restore __P((void));
-int rest_f __P((char *));
+int rest_f __P((const char *));
/* getinp.c */
-int getinp __P((char *, char *[]));
+int getinp __P((const char *, const char *const []));
/* houses.c */
void buy_houses __P((void));
@@ -163,10 +163,10 @@ int move_jail __P((int, int ));
void printturn __P((void));
/* misc.c */
-int getyn __P((char *));
+int getyn __P((const char *));
void notify __P((void));
void next_play __P((void));
-int get_int __P((char *));
+int get_int __P((const char *));
void set_ownlist __P((int));
void is_monop __P((MON *, int));
void isnot_monop __P((MON *));
diff --git a/monop/morg.c b/monop/morg.c
index 80860f63..2c74f917 100644
--- a/monop/morg.c
+++ b/monop/morg.c
@@ -1,4 +1,4 @@
-/* $NetBSD: morg.c,v 1.7 1999/08/21 10:40:04 simonb Exp $ */
+/* $NetBSD: morg.c,v 1.8 1999/09/08 21:17:52 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)morg.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: morg.c,v 1.7 1999/08/21 10:40:04 simonb Exp $");
+__RCSID("$NetBSD: morg.c,v 1.8 1999/09/08 21:17:52 jsm Exp $");
#endif
#endif /* not lint */
@@ -48,8 +48,8 @@ __RCSID("$NetBSD: morg.c,v 1.7 1999/08/21 10:40:04 simonb Exp $");
* These routines deal with mortgaging.
*/
-static char *names[MAX_PRP+2],
- *morg_coms[] = {
+static const char *names[MAX_PRP+2],
+ *const morg_coms[] = {
"quit", /* 0 */
"print", /* 1 */
"where", /* 2 */
diff --git a/monop/print.c b/monop/print.c
index a55434f1..5f0dcd22 100644
--- a/monop/print.c
+++ b/monop/print.c
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
+/* $NetBSD: print.c,v 1.6 1999/09/08 21:17:52 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,15 +38,15 @@
#if 0
static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: print.c,v 1.5 1999/08/21 10:40:04 simonb Exp $");
+__RCSID("$NetBSD: print.c,v 1.6 1999/09/08 21:17:52 jsm Exp $");
#endif
#endif /* not lint */
#include "monop.ext"
-static char *header = "Name Own Price Mg # Rent";
+static const char *header = "Name Own Price Mg # Rent";
-static void printmorg __P((SQUARE *));
+static void printmorg __P((const SQUARE *));
/*
* This routine prints out the current board
@@ -168,7 +168,7 @@ printsq(sqn, eoln)
*/
static void
printmorg(sqp)
- SQUARE *sqp;
+ const SQUARE *sqp;
{
if (sqp->desc->morg)
printf(" * ");
diff --git a/monop/spec.c b/monop/spec.c
index 37d04271..702faaa4 100644
--- a/monop/spec.c
+++ b/monop/spec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spec.c,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
+/* $NetBSD: spec.c,v 1.6 1999/09/08 21:17:52 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,13 +38,13 @@
#if 0
static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: spec.c,v 1.5 1999/08/21 10:40:04 simonb Exp $");
+__RCSID("$NetBSD: spec.c,v 1.6 1999/09/08 21:17:52 jsm Exp $");
#endif
#endif /* not lint */
#include "monop.ext"
-static char *perc[] = {
+static const char *const perc[] = {
"10%", "ten percent", "%", "$200", "200", 0
};
diff --git a/monop/trade.c b/monop/trade.c
index 322d880b..9a9056e4 100644
--- a/monop/trade.c
+++ b/monop/trade.c
@@ -1,4 +1,4 @@
-/* $NetBSD: trade.c,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
+/* $NetBSD: trade.c,v 1.6 1999/09/08 21:17:52 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)trade.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: trade.c,v 1.5 1999/08/21 10:40:04 simonb Exp $");
+__RCSID("$NetBSD: trade.c,v 1.6 1999/09/08 21:17:52 jsm Exp $");
#endif
#endif /* not lint */
@@ -53,7 +53,7 @@ struct trd_st { /* how much to give to other player */
typedef struct trd_st TRADE;
-static char *plist[MAX_PRP+2];
+static const char *plist[MAX_PRP+2];
static int used[MAX_PRP];