summaryrefslogtreecommitdiffstats
path: root/snake
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 /snake
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 'snake')
-rw-r--r--snake/snake/move.c16
-rw-r--r--snake/snake/snake.c18
-rw-r--r--snake/snake/snake.h20
-rw-r--r--snake/snscore/snscore.c6
4 files changed, 29 insertions, 31 deletions
diff --git a/snake/snake/move.c b/snake/snake/move.c
index 4620e02a..2308aeb5 100644
--- a/snake/snake/move.c
+++ b/snake/snake/move.c
@@ -1,4 +1,4 @@
-/* $NetBSD: move.c,v 1.16 1999/08/14 16:38:45 tron Exp $ */
+/* $NetBSD: move.c,v 1.17 1999/09/08 21:17:59 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 7/19/93";
#else
-__RCSID("$NetBSD: move.c,v 1.16 1999/08/14 16:38:45 tron Exp $");
+__RCSID("$NetBSD: move.c,v 1.17 1999/09/08 21:17:59 jsm Exp $");
#endif
#endif /* not lint */
@@ -192,7 +192,7 @@ move(sp)
void
gto(sp)
- struct point *sp;
+ const struct point *sp;
{
int distance, f, tfield;
@@ -264,7 +264,7 @@ gto(sp)
void
right(sp)
- struct point *sp;
+ const struct point *sp;
{
int field, tfield;
int tabcol, strlength;
@@ -429,10 +429,10 @@ pch(c)
void
#if __STDC__
-apr(struct point * ps, const char *fmt,...)
+apr(const struct point * ps, const char *fmt,...)
#else
apr(ps, fmt, va_alist)
- struct point *ps;
+ const struct point *ps;
char *fmt;
va_dcl
#endif
@@ -512,7 +512,7 @@ pstring(s)
void
pchar(ps, ch)
- struct point *ps;
+ const struct point *ps;
char ch;
{
struct point p;
@@ -546,7 +546,7 @@ outch(c)
void
putpad(str)
- char *str;
+ const char *str;
{
if (str)
tputs(str, 1, outch);
diff --git a/snake/snake/snake.c b/snake/snake/snake.c
index eaa30b81..49507b59 100644
--- a/snake/snake/snake.c
+++ b/snake/snake/snake.c
@@ -1,4 +1,4 @@
-/* $NetBSD: snake.c,v 1.9 1997/10/12 01:49:28 lukem Exp $ */
+/* $NetBSD: snake.c,v 1.10 1999/09/08 21:17:59 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94";
#else
-__RCSID("$NetBSD: snake.c,v 1.9 1997/10/12 01:49:28 lukem Exp $");
+__RCSID("$NetBSD: snake.c,v 1.10 1999/09/08 21:17:59 jsm Exp $");
#endif
#endif /* not lint */
@@ -547,13 +547,13 @@ flushi()
tcflush(0, TCIFLUSH);
}
-int mx[8] = {
+const int mx[8] = {
0, 1, 1, 1, 0, -1, -1, -1
};
-int my[8] = {
+const int my[8] = {
-1, -1, 0, 1, 1, 1, 0, -1
};
-float absv[8] = {
+const float absv[8] = {
1, 1.4, 1, 1.4, 1, 1.4, 1, 1.4
};
int oldw = 0;
@@ -626,7 +626,7 @@ spacewarp(w)
{
struct point p;
int j;
- char *str;
+ const char *str;
snrand(&you);
point(&p, COLUMNS / 2 - 8, LINES / 2 - 1);
@@ -693,7 +693,7 @@ snap()
int
stretch(ps)
- struct point *ps;
+ const struct point *ps;
{
struct point p;
@@ -771,7 +771,7 @@ surround(ps)
void
win(ps)
- struct point *ps;
+ const struct point *ps;
{
struct point x;
int j, k;
@@ -854,7 +854,7 @@ pushsnake()
int
chk(sp)
- struct point *sp;
+ const struct point *sp;
{
int j;
diff --git a/snake/snake/snake.h b/snake/snake/snake.h
index 1952385d..0199ff52 100644
--- a/snake/snake/snake.h
+++ b/snake/snake/snake.h
@@ -1,4 +1,4 @@
-/* $NetBSD: snake.h,v 1.11 1999/08/14 16:38:46 tron Exp $ */
+/* $NetBSD: snake.h,v 1.12 1999/09/08 21:18:00 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -81,10 +81,10 @@ struct termios orig, new;
#define same(s1, s2) ((s1)->line == (s2)->line && (s1)->col == (s2)->col)
-void apr __P((struct point *, const char *, ...));
+void apr __P((const struct point *, const char *, ...));
void bs __P((void));
void chase __P((struct point *, struct point *));
-int chk __P((struct point *));
+int chk __P((const struct point *));
void clear __P((void));
void cook __P((void));
void cr __P((void));
@@ -94,7 +94,7 @@ void down __P((void));
void drawbox __P((void));
void flushi __P((void));
void getcap __P((void));
-void gto __P((struct point *));
+void gto __P((const struct point *));
void home __P((void));
void length __P((int));
void ll __P((void));
@@ -104,25 +104,23 @@ void move __P((struct point *));
void nd __P((void));
void outch __P((int));
void pch __P((int));
-void pchar __P((struct point *, char));
+void pchar __P((const struct point *, char));
struct point *point __P((struct point *, int, int));
int post __P((int, int));
void pr __P((const char *, ...));
void pstring __P((const char *));
int pushsnake __P((void));
-void putpad __P((char *));
+void putpad __P((const char *));
void raw __P((void));
-void right __P((struct point *));
+void right __P((const struct point *));
void setup __P((void));
void snap __P((void));
-void snap __P((void));
void snrand __P((struct point *));
void spacewarp __P((int));
void stop __P((int)) __attribute__((__noreturn__));
-int stretch __P((struct point *));
-int stretch __P((struct point *));
+int stretch __P((const struct point *));
void surround __P((struct point *));
void suspend __P((void));
void up __P((void));
-void win __P((struct point *));
+void win __P((const struct point *));
void winnings __P((int));
diff --git a/snake/snscore/snscore.c b/snake/snscore/snscore.c
index 48d99f78..b5f57cf3 100644
--- a/snake/snscore/snscore.c
+++ b/snake/snscore/snscore.c
@@ -1,4 +1,4 @@
-/* $NetBSD: snscore.c,v 1.8 1998/09/11 14:25:22 hubertf Exp $ */
+/* $NetBSD: snscore.c,v 1.9 1999/09/08 21:18:00 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)snscore.c 8.1 (Berkeley) 7/19/93";
#else
-__RCSID("$NetBSD: snscore.c,v 1.8 1998/09/11 14:25:22 hubertf Exp $");
+__RCSID("$NetBSD: snscore.c,v 1.9 1999/09/08 21:18:00 jsm Exp $");
#endif
#endif /* not lint */
@@ -55,7 +55,7 @@ __RCSID("$NetBSD: snscore.c,v 1.8 1998/09/11 14:25:22 hubertf Exp $");
#include <string.h>
#include "pathnames.h"
-char *recfile = _PATH_RAWSCORES;
+const char *recfile = _PATH_RAWSCORES;
#define MAXPLAYERS 256
struct player {