summaryrefslogtreecommitdiffstats
path: root/atc
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-08-12 04:48:03 +0000
committerdholland <dholland@NetBSD.org>2009-08-12 04:48:03 +0000
commitc3bf93e0abeaf9b5ea304d3573f2beda026b1a1b (patch)
tree8d9e8de203da8b607b81155eb25ac077fc12290f /atc
parent63e571cca69e7558ecb2d0e2e654eff896c0ac62 (diff)
downloadbsdgames-darwin-c3bf93e0abeaf9b5ea304d3573f2beda026b1a1b.tar.gz
bsdgames-darwin-c3bf93e0abeaf9b5ea304d3573f2beda026b1a1b.tar.zst
bsdgames-darwin-c3bf93e0abeaf9b5ea304d3573f2beda026b1a1b.zip
sprinkle static
Diffstat (limited to 'atc')
-rw-r--r--atc/extern.c7
-rw-r--r--atc/extern.h47
-rw-r--r--atc/grammar.y25
-rw-r--r--atc/graphics.c10
-rw-r--r--atc/input.c97
-rw-r--r--atc/log.c8
-rw-r--r--atc/main.c17
-rw-r--r--atc/update.c14
8 files changed, 112 insertions, 113 deletions
diff --git a/atc/extern.c b/atc/extern.c
index b0179972..345d4cc8 100644
--- a/atc/extern.c
+++ b/atc/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.10 2008/01/31 05:19:44 dholland Exp $ */
+/* $NetBSD: extern.c,v 1.11 2009/08/12 04:48:03 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: extern.c,v 1.10 2008/01/31 05:19:44 dholland Exp $");
+__RCSID("$NetBSD: extern.c,v 1.11 2009/08/12 04:48:03 dholland Exp $");
#endif
#endif /* not lint */
@@ -63,7 +63,8 @@ const char *filename;
FILE *filein, *fileout;
#endif
-C_SCREEN screen, *sp = &screen;
+static C_SCREEN screen;
+C_SCREEN *sp = &screen;
LIST air, ground;
diff --git a/atc/extern.h b/atc/extern.h
index 31174ead..2b23e4b4 100644
--- a/atc/extern.h
+++ b/atc/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.15 2009/05/25 23:48:32 dholland Exp $ */
+/* $NetBSD: extern.h,v 1.16 2009/08/12 04:48:03 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -53,7 +53,7 @@ extern time_t start_time;
extern FILE *filein, *fileout;
#endif
-extern C_SCREEN screen, *sp;
+extern C_SCREEN *sp;
extern LIST air, ground;
@@ -64,78 +64,35 @@ extern DISPLACEMENT displacement[MAXDIR];
int addplane(void);
void append(LIST *, PLANE *);
void check_adir(int, int, int);
-void check_edge(int, int);
-void check_edir(int, int, int);
-void check_line(int, int, int, int);
-void check_linepoint(int, int);
-void check_point(int, int);
-int checkdefs(void);
-int compar(const void *, const void *);
void delete(LIST *, PLANE *);
-int dir_deg(int);
int dir_no(int);
void done_screen(void);
void draw_all(void);
-void draw_line(WINDOW *, int, int, int, int, const char *);
void erase_all(void);
int getAChar(void);
int getcommand(void);
-int gettoken(void);
void init_gr(void);
void ioaddstr(int, const char *);
void ioclrtobot(void);
void ioclrtoeol(int);
void ioerror(int, int, const char *);
void iomove(int);
-int list_games(void);
int log_score(int);
void log_score_quit(int) __dead;
void loser(const PLANE *, const char *) __dead;
int main(int, char *[]);
char name(const PLANE *);
-int next_plane(void);
-void noise(void);
int number(int);
void open_score_file(void);
void planewin(void);
-int pop(void);
-void push(int, int);
void quit(int);
-int read_file(const char *);
void redraw(void);
-void rezero(void);
void setup_screen(const C_SCREEN *);
-int too_close(const PLANE *p1, const PLANE *p2, int);
void update(int);
-int yyerror(const char *);
int yylex(void);
#ifndef YYEMPTY
int yyparse(void);
#endif
-const char *Left(int);
-const char *Right(int);
-const char *airport(int);
-const char *beacon(int);
-const char *benum(int);
-const char *circle(int);
-const char *climb(int);
const char *command(const PLANE *);
-const char *default_game(void);
-const char *delayb(int);
-const char *descend(int);
-const char *ex_it(int);
PLANE *findplane(int);
-const char *ignore(int);
-const char *left(int);
-const char *mark(int);
PLANE *newplane(void);
-const char *okay_game(const char *);
-const char *rel_dir(int);
-const char *right(int);
-const char *setalt(int);
-const char *setplane(int);
-const char *setrelalt(int);
-const char *timestr(int);
-const char *to_dir(int);
-const char *turn(int);
-const char *unmark(int);
diff --git a/atc/grammar.y b/atc/grammar.y
index 5b37eaae..3e22818d 100644
--- a/atc/grammar.y
+++ b/atc/grammar.y
@@ -1,4 +1,4 @@
-/* $NetBSD: grammar.y,v 1.9 2005/07/01 00:48:34 jmc Exp $ */
+/* $NetBSD: grammar.y,v 1.10 2009/08/12 04:48:03 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -64,12 +64,15 @@
#if 0
static char sccsid[] = "@(#)grammar.y 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: grammar.y,v 1.9 2005/07/01 00:48:34 jmc Exp $");
+__RCSID("$NetBSD: grammar.y,v 1.10 2009/08/12 04:48:03 dholland Exp $");
#endif
#endif /* not lint */
-int errors = 0;
-int line = 1;
+int line = 1;
+
+static int errors = 0;
+
+static int yyerror(const char *);
%}
%%
@@ -284,7 +287,7 @@ Lline:
;
%%
-void
+static void
check_edge(int x, int y)
{
if (!(x == 0) && !(x == sp->width - 1) &&
@@ -292,7 +295,7 @@ check_edge(int x, int y)
yyerror("edge value not on edge.");
}
-void
+static void
check_point(int x, int y)
{
if (x < 1 || x >= sp->width - 1)
@@ -301,7 +304,7 @@ check_point(int x, int y)
yyerror("Y value out of range.");
}
-void
+static void
check_linepoint(int x, int y)
{
if (x < 0 || x >= sp->width)
@@ -310,7 +313,7 @@ check_linepoint(int x, int y)
yyerror("Y value out of range.");
}
-void
+static void
check_line(int px1, int py1, int px2, int py2)
{
int d1, d2;
@@ -325,7 +328,7 @@ check_line(int px1, int py1, int px2, int py2)
yyerror("Bad line endpoints.");
}
-int
+static int
yyerror(const char *s)
{
fprintf(stderr, "\"%s\": line %d: %s\n", filename, line, s);
@@ -334,7 +337,7 @@ yyerror(const char *s)
return (errors);
}
-void
+static void
check_edir(int x, int y, int dir)
{
int bad = 0;
@@ -366,7 +369,7 @@ check_edir(int x, int y, int dir)
yyerror("Bad direction for entrance at exit.");
}
-int
+static int
checkdefs(void)
{
int error = 0;
diff --git a/atc/graphics.c b/atc/graphics.c
index c29b2674..f081c973 100644
--- a/atc/graphics.c
+++ b/atc/graphics.c
@@ -1,4 +1,4 @@
-/* $NetBSD: graphics.c,v 1.15 2008/08/08 16:10:47 drochner Exp $ */
+/* $NetBSD: graphics.c,v 1.16 2009/08/12 04:48:03 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)graphics.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: graphics.c,v 1.15 2008/08/08 16:10:47 drochner Exp $");
+__RCSID("$NetBSD: graphics.c,v 1.16 2009/08/12 04:48:03 dholland Exp $");
#endif
#endif /* not lint */
@@ -60,7 +60,9 @@ __RCSID("$NetBSD: graphics.c,v 1.15 2008/08/08 16:10:47 drochner Exp $");
#define C_BEACON '*'
#define C_CREDIT '*'
-WINDOW *radar, *cleanradar, *credit, *input, *planes;
+static void draw_line(WINDOW *, int, int, int, int, const char *);
+
+static WINDOW *radar, *cleanradar, *credit, *input, *planes;
int
getAChar(void)
@@ -216,7 +218,7 @@ setup_screen(const C_SCREEN *scp)
(void)fflush(stdout);
}
-void
+static void
draw_line(WINDOW *w, int x, int y, int lx, int ly, const char *s)
{
int dx, dy;
diff --git a/atc/input.c b/atc/input.c
index a2b49f5a..62947cd4 100644
--- a/atc/input.c
+++ b/atc/input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: input.c,v 1.23 2009/05/26 00:00:56 dholland Exp $ */
+/* $NetBSD: input.c,v 1.24 2009/08/12 04:48:03 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,13 +46,40 @@
#if 0
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: input.c,v 1.23 2009/05/26 00:00:56 dholland Exp $");
+__RCSID("$NetBSD: input.c,v 1.24 2009/08/12 04:48:03 dholland Exp $");
#endif
#endif /* not lint */
#include "include.h"
#include "pathnames.h"
+static void rezero(void);
+static void noise(void);
+static int gettoken(void);
+static const char *setplane(int);
+static const char *turn(int);
+static const char *circle(int);
+static const char *left(int);
+static const char *right(int);
+static const char *Left(int);
+static const char *Right(int);
+static const char *delayb(int);
+static const char *beacon(int);
+static const char *ex_it(int);
+static const char *airport(int);
+static const char *climb(int);
+static const char *descend(int);
+static const char *setalt(int);
+static const char *setrelalt(int);
+static const char *benum(int);
+static const char *to_dir(int);
+static const char *rel_dir(int);
+static const char *mark(int);
+static const char *unmark(int);
+static const char *ignore(int);
+
+
+
#define MAXRULES 6
#define MAXDEPTH 15
@@ -93,7 +120,7 @@ typedef struct {
#define NUMSTATES NUMELS(st)
-
+static
RULE state0[] = { { ALPHATOKEN, 1, "%c:", setplane},
{ RETTOKEN, -1, "", NULL },
{ HELPTOKEN, 12, " [a-z]<ret>", NULL }},
@@ -160,7 +187,7 @@ RULE state0[] = { { ALPHATOKEN, 1, "%c:", setplane},
#define DEF_STATE(s) { NUMELS(s), (s) }
-STATE st[] = {
+static STATE st[] = {
DEF_STATE(state0), DEF_STATE(state1), DEF_STATE(state2),
DEF_STATE(state3), DEF_STATE(state4), DEF_STATE(state5),
DEF_STATE(state6), DEF_STATE(state7), DEF_STATE(state8),
@@ -168,13 +195,13 @@ STATE st[] = {
DEF_STATE(state12)
};
-PLANE p;
-STACK stack[MAXDEPTH];
-int level;
-int tval;
-int dest_type, dest_no, dir;
+static PLANE p;
+static STACK stack[MAXDEPTH];
+static int level;
+static int tval;
+static int dest_type, dest_no, dir;
-int
+static int
pop(void)
{
if (level == 0)
@@ -189,7 +216,7 @@ pop(void)
return (0);
}
-void
+static void
rezero(void)
{
iomove(0);
@@ -202,7 +229,7 @@ rezero(void)
(void)strcpy(T_STR, "");
}
-void
+static void
push(int ruleno, int ch)
{
int newstate, newpos;
@@ -286,14 +313,14 @@ getcommand(void)
return (0);
}
-void
+static void
noise(void)
{
(void)putchar('\07');
(void)fflush(stdout);
}
-int
+static int
gettoken(void)
{
while ((tval = getAChar()) == REDRAWTOKEN || tval == SHELLTOKEN)
@@ -357,7 +384,7 @@ gettoken(void)
return (tval);
}
-const char *
+static const char *
setplane(int c)
{
PLANE *pp;
@@ -371,7 +398,7 @@ setplane(int c)
}
/* ARGSUSED */
-const char *
+static const char *
turn(int c __unused)
{
if (p.altitude == 0)
@@ -380,7 +407,7 @@ turn(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
circle(int c __unused)
{
if (p.altitude == 0)
@@ -390,7 +417,7 @@ circle(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
left(int c __unused)
{
dir = D_LEFT;
@@ -401,7 +428,7 @@ left(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
right(int c __unused)
{
dir = D_RIGHT;
@@ -412,7 +439,7 @@ right(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
Left(int c __unused)
{
p.new_dir = p.dir - 2;
@@ -422,7 +449,7 @@ Left(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
Right(int c __unused)
{
p.new_dir = p.dir + 2;
@@ -431,7 +458,7 @@ Right(int c __unused)
return (NULL);
}
-const char *
+static const char *
delayb(int c)
{
int xdiff, ydiff;
@@ -476,7 +503,7 @@ delayb(int c)
}
/* ARGSUSED */
-const char *
+static const char *
beacon(int c __unused)
{
dest_type = T_BEACON;
@@ -484,7 +511,7 @@ beacon(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
ex_it(int c __unused)
{
dest_type = T_EXIT;
@@ -492,7 +519,7 @@ ex_it(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
airport(int c __unused)
{
dest_type = T_AIRPORT;
@@ -500,7 +527,7 @@ airport(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
climb(int c __unused)
{
dir = D_UP;
@@ -508,14 +535,14 @@ climb(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
descend(int c __unused)
{
dir = D_DOWN;
return (NULL);
}
-const char *
+static const char *
setalt(int c)
{
int newalt = c - '0';
@@ -528,7 +555,7 @@ setalt(int c)
return (NULL);
}
-const char *
+static const char *
setrelalt(int c)
{
int newalt;
@@ -559,7 +586,7 @@ setrelalt(int c)
return (NULL);
}
-const char *
+static const char *
benum(int c)
{
dest_no = c -= '0';
@@ -589,14 +616,14 @@ benum(int c)
return (NULL);
}
-const char *
+static const char *
to_dir(int c)
{
p.new_dir = dir_no(c);
return (NULL);
}
-const char *
+static const char *
rel_dir(int c)
{
int angle;
@@ -620,7 +647,7 @@ rel_dir(int c)
}
/* ARGSUSED */
-const char *
+static const char *
mark(int c __unused)
{
if (p.altitude == 0)
@@ -632,7 +659,7 @@ mark(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
unmark(int c __unused)
{
if (p.altitude == 0)
@@ -644,7 +671,7 @@ unmark(int c __unused)
}
/* ARGSUSED */
-const char *
+static const char *
ignore(int c __unused)
{
if (p.altitude == 0)
diff --git a/atc/log.c b/atc/log.c
index 3f9572a0..99c0a43e 100644
--- a/atc/log.c
+++ b/atc/log.c
@@ -1,4 +1,4 @@
-/* $NetBSD: log.c,v 1.20 2009/05/26 00:00:56 dholland Exp $ */
+/* $NetBSD: log.c,v 1.21 2009/08/12 04:48:03 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: log.c,v 1.20 2009/05/26 00:00:56 dholland Exp $");
+__RCSID("$NetBSD: log.c,v 1.21 2009/08/12 04:48:03 dholland Exp $");
#endif
#endif /* not lint */
@@ -55,7 +55,7 @@ __RCSID("$NetBSD: log.c,v 1.20 2009/05/26 00:00:56 dholland Exp $");
static FILE *score_fp;
-int
+static int
compar(const void *va, const void *vb)
{
const SCORE *a, *b;
@@ -78,7 +78,7 @@ compar(const void *va, const void *vb)
#define MIN(t) (((t) % SECAHOUR) / SECAMIN)
#define SEC(t) ((t) % SECAMIN)
-const char *
+static const char *
timestr(int t)
{
static char s[80];
diff --git a/atc/main.c b/atc/main.c
index e47388a5..49c5d6aa 100644
--- a/atc/main.c
+++ b/atc/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.19 2008/07/20 01:03:20 lukem Exp $ */
+/* $NetBSD: main.c,v 1.20 2009/08/12 04:48:03 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: main.c,v 1.19 2008/07/20 01:03:20 lukem Exp $");
+__RCSID("$NetBSD: main.c,v 1.20 2009/08/12 04:48:03 dholland Exp $");
#endif
#endif /* not lint */
@@ -60,6 +60,11 @@ __RCSID("$NetBSD: main.c,v 1.19 2008/07/20 01:03:20 lukem Exp $");
extern FILE *yyin;
+static int read_file(const char *);
+static const char *default_game(void);
+static const char *okay_game(const char *);
+static int list_games(void);
+
int
main(int argc, char *argv[])
{
@@ -204,7 +209,7 @@ main(int argc, char *argv[])
}
}
-int
+static int
read_file(const char *s)
{
int retval;
@@ -224,7 +229,7 @@ read_file(const char *s)
return (0);
}
-const char *
+static const char *
default_game(void)
{
FILE *fp;
@@ -250,7 +255,7 @@ default_game(void)
return (file);
}
-const char *
+static const char *
okay_game(const char *s)
{
FILE *fp;
@@ -285,7 +290,7 @@ okay_game(const char *s)
return (ret);
}
-int
+static int
list_games(void)
{
FILE *fp;
diff --git a/atc/update.c b/atc/update.c
index 0fcc967f..c3741fb7 100644
--- a/atc/update.c
+++ b/atc/update.c
@@ -1,4 +1,4 @@
-/* $NetBSD: update.c,v 1.20 2009/05/26 00:00:56 dholland Exp $ */
+/* $NetBSD: update.c,v 1.21 2009/08/12 04:48:03 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,12 +46,16 @@
#if 0
static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: update.c,v 1.20 2009/05/26 00:00:56 dholland Exp $");
+__RCSID("$NetBSD: update.c,v 1.21 2009/08/12 04:48:03 dholland Exp $");
#endif
#endif /* not lint */
#include "include.h"
+static int next_plane(void);
+static int too_close(const PLANE *p1, const PLANE *p2, int);
+static int dir_deg(int);
+
/* ARGSUSED */
void
update(int dummy __unused)
@@ -274,7 +278,7 @@ number(int l)
return (-1);
}
-int
+static int
next_plane(void)
{
static int last_plane = -1;
@@ -390,7 +394,7 @@ findplane(int n)
return (NULL);
}
-int
+static int
too_close(const PLANE *p1, const PLANE *p2, int dist)
{
if (ABS(p1->altitude - p2->altitude) <= dist &&
@@ -401,7 +405,7 @@ too_close(const PLANE *p1, const PLANE *p2, int dist)
return (0);
}
-int
+static int
dir_deg(int d)
{
switch (d) {