summaryrefslogtreecommitdiffstats
path: root/snake
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-08-12 08:44:45 +0000
committerdholland <dholland@NetBSD.org>2009-08-12 08:44:45 +0000
commit39a1066cab493ece48c6e692513d1311b7e27c44 (patch)
treea896a49b2b5b09b9763d953ea2ce9ec0e813beb3 /snake
parent4fa17c6f9afc7c76d0350d5d9e5996391aa18137 (diff)
downloadbsdgames-darwin-39a1066cab493ece48c6e692513d1311b7e27c44.tar.gz
bsdgames-darwin-39a1066cab493ece48c6e692513d1311b7e27c44.tar.zst
bsdgames-darwin-39a1066cab493ece48c6e692513d1311b7e27c44.zip
sprinkle static
Diffstat (limited to 'snake')
-rw-r--r--snake/snake/snake.c123
-rw-r--r--snake/snscore/snscore.c10
2 files changed, 67 insertions, 66 deletions
diff --git a/snake/snake/snake.c b/snake/snake/snake.c
index cac56136..2db38721 100644
--- a/snake/snake/snake.c
+++ b/snake/snake/snake.c
@@ -1,4 +1,4 @@
-/* $NetBSD: snake.c,v 1.25 2008/08/08 16:10:47 drochner Exp $ */
+/* $NetBSD: snake.c,v 1.26 2009/08/12 08:48:15 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\
#if 0
static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94";
#else
-__RCSID("$NetBSD: snake.c,v 1.25 2008/08/08 16:10:47 drochner Exp $");
+__RCSID("$NetBSD: snake.c,v 1.26 2009/08/12 08:48:15 dholland Exp $");
#endif
#endif /* not lint */
@@ -99,44 +99,43 @@ struct point {
#define pchar(point, c) mvaddch((point)->line + 1, (point)->col + 1, (c))
#define delay(t) usleep(t * 50000);
-struct point you;
-struct point money;
-struct point finish;
-struct point snake[6];
+static struct point you;
+static struct point money;
+static struct point finish;
+static struct point snake[6];
+
+static int loot, penalty;
+static int moves;
+static int fast = 1;
+
+static int rawscores;
+static FILE *logfile;
+
+static int lcnt, ccnt; /* user's idea of screen size */
+static int chunk; /* amount of money given at a time */
+
+static void chase(struct point *, struct point *);
+static int chk(const struct point *);
+static void drawbox(void);
+static void flushi(void);
+static void length(int);
+static void logit(const char *);
+static void mainloop(void) __dead;
+static struct point *point(struct point *, int, int);
+static int post(int, int);
+static int pushsnake(void);
+static void setup(void);
+static void snap(void);
+static void snrand(struct point *);
+static void spacewarp(int);
+static void stop(int) __dead;
+static int stretch(const struct point *);
+static void surround(struct point *);
+static void suspend(void);
+static void win(const struct point *);
+static void winnings(int);
-int loot, penalty;
-int moves;
-int fast = 1;
-
-int rawscores;
-FILE *logfile;
-
-int lcnt, ccnt; /* user's idea of screen size */
-int chunk; /* amount of money given at a time */
-
-void chase(struct point *, struct point *);
-int chk(const struct point *);
-void drawbox(void);
-void flushi(void);
-void home(void);
-void length(int);
-void logit(const char *);
int main(int, char **);
-void mainloop(void) __dead;
-struct point *point(struct point *, int, int);
-int post(int, int);
-int pushsnake(void);
-void right(const struct point *);
-void setup(void);
-void snap(void);
-void snrand(struct point *);
-void spacewarp(int);
-void stop(int) __dead;
-int stretch(const struct point *);
-void surround(struct point *);
-void suspend(void);
-void win(const struct point *);
-void winnings(int);
int
main(argc, argv)
@@ -247,7 +246,7 @@ main(argc, argv)
return (0);
}
-struct point *
+static struct point *
point(ps, x, y)
struct point *ps;
int x, y;
@@ -258,7 +257,7 @@ point(ps, x, y)
}
/* Main command loop */
-void
+static void
mainloop()
{
int k;
@@ -447,7 +446,7 @@ mainloop()
/*
* setup the board
*/
-void
+static void
setup()
{
int i;
@@ -464,7 +463,7 @@ setup()
refresh();
}
-void
+static void
drawbox()
{
int i;
@@ -479,7 +478,7 @@ drawbox()
}
}
-void
+static void
snrand(sp)
struct point *sp;
{
@@ -509,7 +508,7 @@ snrand(sp)
*sp = p;
}
-int
+static int
post(iscore, flag)
int iscore, flag;
{
@@ -584,24 +583,24 @@ post(iscore, flag)
* overshooting. This loses horribly at 9600 baud, but works nicely
* if the terminal gets behind.
*/
-void
+static void
flushi()
{
tcflush(0, TCIFLUSH);
}
-const int mx[8] = {
+static const int mx[8] = {
0, 1, 1, 1, 0, -1, -1, -1
};
-const int my[8] = {
+static const int my[8] = {
-1, -1, 0, 1, 1, 1, 0, -1
};
-const float absv[8] = {
+static const float absv[8] = {
1, 1.4, 1, 1.4, 1, 1.4, 1, 1.4
};
-int oldw = 0;
+static int oldw = 0;
-void
+static void
chase(np, sp)
struct point *sp, *np;
{
@@ -663,7 +662,7 @@ chase(np, sp)
point(np, sp->col + mx[w], sp->line + my[w]);
}
-void
+static void
spacewarp(w)
int w;
{
@@ -697,7 +696,7 @@ spacewarp(w)
winnings(cashvalue);
}
-void
+static void
snap()
{
#if 0 /* This code doesn't really make sense. */
@@ -744,7 +743,7 @@ snap()
refresh();
}
-int
+static int
stretch(ps)
const struct point *ps;
{
@@ -792,7 +791,7 @@ stretch(ps)
return (0);
}
-void
+static void
surround(ps)
struct point *ps;
{
@@ -836,7 +835,7 @@ surround(ps)
delay(6);
}
-void
+static void
win(ps)
const struct point *ps;
{
@@ -869,7 +868,7 @@ win(ps)
}
}
-int
+static int
pushsnake()
{
int i, bonus;
@@ -926,7 +925,7 @@ pushsnake()
return (0);
}
-int
+static int
chk(sp)
const struct point *sp;
{
@@ -964,7 +963,7 @@ chk(sp)
return (0);
}
-void
+static void
winnings(won)
int won;
{
@@ -973,7 +972,7 @@ winnings(won)
}
}
-void
+static void
stop(dummy)
int dummy __unused;
{
@@ -983,7 +982,7 @@ stop(dummy)
exit(0);
}
-void
+static void
suspend()
{
endwin();
@@ -992,14 +991,14 @@ suspend()
winnings(cashvalue);
}
-void
+static void
length(num)
int num;
{
printf("You made %d moves.\n", num);
}
-void
+static void
logit(msg)
const char *msg;
{
diff --git a/snake/snscore/snscore.c b/snake/snscore/snscore.c
index b09d5180..74c840db 100644
--- a/snake/snscore/snscore.c
+++ b/snake/snscore/snscore.c
@@ -1,4 +1,4 @@
-/* $NetBSD: snscore.c,v 1.17 2008/07/20 01:03:22 lukem Exp $ */
+/* $NetBSD: snscore.c,v 1.18 2009/08/12 08:48:56 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\
#if 0
static char sccsid[] = "@(#)snscore.c 8.1 (Berkeley) 7/19/93";
#else
-__RCSID("$NetBSD: snscore.c,v 1.17 2008/07/20 01:03:22 lukem Exp $");
+__RCSID("$NetBSD: snscore.c,v 1.18 2009/08/12 08:48:56 dholland Exp $");
#endif
#endif /* not lint */
@@ -52,14 +52,16 @@ __RCSID("$NetBSD: snscore.c,v 1.17 2008/07/20 01:03:22 lukem Exp $");
#include <unistd.h>
#include "pathnames.h"
-const char *recfile = _PATH_RAWSCORES;
+static const char *recfile = _PATH_RAWSCORES;
#define MAXPLAYERS 256
struct player {
short uids;
short scores;
char *name;
-} players[MAXPLAYERS], temp;
+};
+
+static struct player players[MAXPLAYERS], temp;
int main(void);