summaryrefslogtreecommitdiffstats
path: root/games/atc
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1999-04-19 03:59:02 +0000
committersteve <steve@FreeBSD.org>1999-04-19 03:59:02 +0000
commitd59a3ca336bac3dac6ad8918ff6cb28fcbbba718 (patch)
treec2b57d23128f242645f8e3e16274a587229383ec /games/atc
parent390eb1b3d201760a5e8b76e2431c1f667648718f (diff)
downloadFreeBSD-src-d59a3ca336bac3dac6ad8918ff6cb28fcbbba718.zip
FreeBSD-src-d59a3ca336bac3dac6ad8918ff6cb28fcbbba718.tar.gz
Merge a bunch of cleanups from NetBSD.
PR: 8083 Submitted by: Stephen J. Roznowski <sjr@home.net> Obtained from: a whole slew of NetBSD PRs
Diffstat (limited to 'games/atc')
-rw-r--r--games/atc/Makefile2
-rw-r--r--games/atc/def.h4
-rw-r--r--games/atc/extern.c2
-rw-r--r--games/atc/extern.h3
-rw-r--r--games/atc/graphics.c18
-rw-r--r--games/atc/input.c58
-rw-r--r--games/atc/log.c14
-rw-r--r--games/atc/main.c14
-rw-r--r--games/atc/update.c14
9 files changed, 73 insertions, 56 deletions
diff --git a/games/atc/Makefile b/games/atc/Makefile
index 87bc65b..d640d73 100644
--- a/games/atc/Makefile
+++ b/games/atc/Makefile
@@ -13,7 +13,5 @@ HIDEGAME=hidegame
beforeinstall:
(cd ${.CURDIR}/games; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 440 \
${GAMES} ${DESTDIR}${SHAREDIR}/games/atc)
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${.CURDIR}/games/ATC_scores \
- ${DESTDIR}/var/games/atc_score
.include <bsd.prog.mk>
diff --git a/games/atc/def.h b/games/atc/def.h
index be34a61..99e3190 100644
--- a/games/atc/def.h
+++ b/games/atc/def.h
@@ -47,7 +47,9 @@
#define AUTHOR_STR "ATC - by Ed James"
-#define PI 3.14159654
+#ifndef PI
+#define PI 3.14159265358979323846
+#endif
#define LOWFUEL 15
diff --git a/games/atc/extern.c b/games/atc/extern.c
index 0b2ada7..ea34434 100644
--- a/games/atc/extern.c
+++ b/games/atc/extern.c
@@ -53,7 +53,7 @@ char GAMES[] = "Game_List";
int clck, safe_planes, start_time, test_mode;
-char *file;
+const char *file;
FILE *filein, *fileout;
diff --git a/games/atc/extern.h b/games/atc/extern.h
index 5f0fa93..4072873 100644
--- a/games/atc/extern.h
+++ b/games/atc/extern.h
@@ -45,7 +45,8 @@
* For more info on this and all of my stuff, mail edjames@berkeley.edu.
*/
-extern char GAMES[], *file;
+extern char GAMES[];
+extern const char *file;
extern int clck, safe_planes, start_time, test_mode;
diff --git a/games/atc/graphics.c b/games/atc/graphics.c
index e7a34bf..ad93d1c 100644
--- a/games/atc/graphics.c
+++ b/games/atc/graphics.c
@@ -122,10 +122,11 @@ init_gr()
}
setup_screen(scp)
- C_SCREEN *scp;
+ const C_SCREEN *scp;
{
register int i, j;
- char str[3], *airstr;
+ char str[3];
+ const char *airstr;
str[2] = '\0';
@@ -213,8 +214,9 @@ setup_screen(scp)
}
draw_line(w, x, y, lx, ly, s)
- WINDOW *w;
- char *s;
+ WINDOW *w;
+ int x, y, lx, ly;
+ const char *s;
{
int dx, dy;
@@ -246,7 +248,7 @@ iomove(pos)
}
ioaddstr(pos, str)
- char *str;
+ const char *str;
{
wmove(input, 0, pos);
waddstr(input, str);
@@ -262,7 +264,7 @@ ioclrtobot()
}
ioerror(pos, len, str)
- char *str;
+ const char *str;
{
int i;
@@ -359,8 +361,8 @@ planewin()
}
loser(p, s)
- PLANE *p;
- char *s;
+ const PLANE *p;
+ const char *s;
{
int c;
#ifdef BSD
diff --git a/games/atc/input.c b/games/atc/input.c
index e5418b7..a913f1f 100644
--- a/games/atc/input.c
+++ b/games/atc/input.c
@@ -66,10 +66,10 @@ static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93";
#define NUMTOKEN 257
typedef struct {
- int token;
- int to_state;
- char *str;
- char *(*func)();
+ int token;
+ int to_state;
+ const char *str;
+ const char *(*func)();
} RULE;
typedef struct {
@@ -95,7 +95,7 @@ typedef struct {
#define NUMSTATES NUMELS(st)
-char *setplane(), *circle(), *left(), *right(), *Left(), *Right(),
+const char *setplane(), *circle(), *left(), *right(), *Left(), *Right(),
*beacon(), *ex_it(), *climb(), *descend(), *setalt(), *setrelalt(),
*benum(), *to_dir(), *rel_dir(), *delayb(), *mark(), *unmark(),
*airport(), *turn(), *ignore();
@@ -241,9 +241,9 @@ push(ruleno, ch)
getcommand()
{
- int c, i, done;
- char *s, *(*func)();
- PLANE *pp;
+ int c, i, done;
+ const char *s, *(*func)();
+ PLANE *pp;
rezero();
@@ -368,7 +368,7 @@ gettoken()
return (tval);
}
-char *
+const char *
setplane(c)
{
PLANE *pp;
@@ -381,7 +381,7 @@ setplane(c)
return (NULL);
}
-char *
+const char *
turn(c)
{
if (p.altitude == 0)
@@ -389,7 +389,7 @@ turn(c)
return (NULL);
}
-char *
+const char *
circle(c)
{
if (p.altitude == 0)
@@ -398,7 +398,7 @@ circle(c)
return (NULL);
}
-char *
+const char *
left(c)
{
dir = D_LEFT;
@@ -408,7 +408,7 @@ left(c)
return (NULL);
}
-char *
+const char *
right(c)
{
dir = D_RIGHT;
@@ -418,7 +418,7 @@ right(c)
return (NULL);
}
-char *
+const char *
Left(c)
{
p.new_dir = p.dir - 2;
@@ -427,7 +427,7 @@ Left(c)
return (NULL);
}
-char *
+const char *
Right(c)
{
p.new_dir = p.dir + 2;
@@ -436,7 +436,7 @@ Right(c)
return (NULL);
}
-char *
+const char *
delayb(c)
{
int xdiff, ydiff;
@@ -481,42 +481,42 @@ delayb(c)
return (NULL);
}
-char *
+const char *
beacon(c)
{
dest_type = T_BEACON;
return (NULL);
}
-char *
+const char *
ex_it(c)
{
dest_type = T_EXIT;
return (NULL);
}
-char *
+const char *
airport(c)
{
dest_type = T_AIRPORT;
return (NULL);
}
-char *
+const char *
climb(c)
{
dir = D_UP;
return (NULL);
}
-char *
+const char *
descend(c)
{
dir = D_DOWN;
return (NULL);
}
-char *
+const char *
setalt(c)
{
if ((p.altitude == c - '0') && (p.new_altitude == p.altitude))
@@ -525,7 +525,7 @@ setalt(c)
return (NULL);
}
-char *
+const char *
setrelalt(c)
{
if (c == 0)
@@ -549,7 +549,7 @@ setrelalt(c)
return (NULL);
}
-char *
+const char *
benum(c)
{
dest_no = c -= '0';
@@ -580,14 +580,14 @@ benum(c)
return (NULL);
}
-char *
+const char *
to_dir(c)
{
p.new_dir = dir_no(c);
return (NULL);
}
-char *
+const char *
rel_dir(c)
{
int angle;
@@ -611,7 +611,7 @@ rel_dir(c)
return (NULL);
}
-char *
+const char *
mark(c)
{
if (p.altitude == 0)
@@ -622,7 +622,7 @@ mark(c)
return (NULL);
}
-char *
+const char *
unmark(c)
{
if (p.altitude == 0)
@@ -633,7 +633,7 @@ unmark(c)
return (NULL);
}
-char *
+const char *
ignore(c)
{
if (p.altitude == 0)
diff --git a/games/atc/log.c b/games/atc/log.c
index f55bf56..cd347a4 100644
--- a/games/atc/log.c
+++ b/games/atc/log.c
@@ -51,9 +51,15 @@ static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 5/31/93";
#include "include.h"
#include "pathnames.h"
-compar(a, b)
- SCORE *a, *b;
+int
+compar(va, vb)
+ const void *va, *vb;
{
+ const SCORE *a, *b;
+
+ a = (const SCORE *)va;
+ b = (const SCORE *)vb;
+
if (b->planes == a->planes)
return (b->time - a->time);
else
@@ -70,7 +76,7 @@ compar(a, b)
#define MIN(t) (((t) % SECAHOUR) / SECAMIN)
#define SEC(t) ((t) % SECAMIN)
-char *
+const char *
timestr(t)
{
static char s[80];
@@ -152,7 +158,7 @@ log_score(list_em)
#endif
#ifdef SYSV
uname(&name);
- strcpy(thisscore.host, name.sysname);
+ strcpy(thisscore.host, name.nodename);
#endif
cp = rindex(file, '/');
diff --git a/games/atc/main.c b/games/atc/main.c
index 115a916..5e225a5 100644
--- a/games/atc/main.c
+++ b/games/atc/main.c
@@ -58,17 +58,18 @@ static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#include "pathnames.h"
main(ac, av)
+ int ac;
char *av[];
{
int seed = 0;
int f_usage = 0, f_list = 0, f_showscore = 0;
int f_printpath = 0;
- char *file = NULL;
+ const char *file = NULL;
char *name, *ptr;
#ifdef BSD
struct itimerval itv;
#endif
- extern char *default_game(), *okay_game();
+ extern const char *default_game(), *okay_game();
extern void log_score(), quit(), update();
start_time = time(0);
@@ -221,7 +222,7 @@ main(ac, av)
}
read_file(s)
- char *s;
+ const char *s;
{
extern FILE *yyin;
int retval;
@@ -241,7 +242,7 @@ read_file(s)
return (0);
}
-char *
+const char *
default_game()
{
FILE *fp;
@@ -266,13 +267,14 @@ default_game()
return (file);
}
-char *
+const char *
okay_game(s)
char *s;
{
FILE *fp;
static char file[256];
- char *ret = NULL, line[256], games[256];
+ const char *ret = NULL;
+ char line[256], games[256];
strcpy(games, _PATH_GAMES);
strcat(games, GAMES);
diff --git a/games/atc/update.c b/games/atc/update.c
index 4e9a5a4..725c3b9 100644
--- a/games/atc/update.c
+++ b/games/atc/update.c
@@ -50,6 +50,8 @@ static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93";
#include <string.h>
#include "include.h"
+char name();
+
update()
{
int i, dir_diff, mask, unclean;
@@ -220,9 +222,9 @@ update()
#endif
}
-char *
+const char *
command(pp)
- PLANE *pp;
+ const PLANE *pp;
{
static char buf[50], *bp, *comm_start;
char *index();
@@ -253,8 +255,9 @@ command(pp)
}
/* char */
+char
name(p)
- PLANE *p;
+ const PLANE *p;
{
if (p->plane_type == 0)
return ('A' + p->plane_no);
@@ -372,6 +375,7 @@ addplane()
PLANE *
findplane(n)
+ int n;
{
PLANE *pp;
@@ -384,8 +388,10 @@ findplane(n)
return (NULL);
}
+int
too_close(p1, p2, dist)
- PLANE *p1, *p2;
+ const PLANE *p1, *p2;
+ int dist;
{
if (ABS(p1->altitude - p2->altitude) <= dist &&
ABS(p1->xpos - p2->xpos) <= dist && ABS(p1->ypos - p2->ypos) <= dist)
OpenPOWER on IntegriCloud