summaryrefslogtreecommitdiffstats
path: root/atc
diff options
context:
space:
mode:
authorjmc <jmc@NetBSD.org>2005-07-01 00:48:34 +0000
committerjmc <jmc@NetBSD.org>2005-07-01 00:48:34 +0000
commit0272ab0970dca7cdbac5a1669e694d8e06ceaec7 (patch)
tree3a01e3fa3bfb4f07e62a92c447ed9a0dd21e05c5 /atc
parentdf8ac21ffab206d3f69612627f47e86356f11a4d (diff)
downloadbsdgames-darwin-0272ab0970dca7cdbac5a1669e694d8e06ceaec7.tar.gz
bsdgames-darwin-0272ab0970dca7cdbac5a1669e694d8e06ceaec7.tar.zst
bsdgames-darwin-0272ab0970dca7cdbac5a1669e694d8e06ceaec7.zip
KNF and WARNS=3 fixes
Diffstat (limited to 'atc')
-rw-r--r--atc/extern.c6
-rw-r--r--atc/extern.h50
-rw-r--r--atc/grammar.y46
-rw-r--r--atc/graphics.c53
-rw-r--r--atc/input.c151
-rw-r--r--atc/list.c16
-rw-r--r--atc/log.c34
-rw-r--r--atc/main.c30
-rw-r--r--atc/update.c43
9 files changed, 185 insertions, 244 deletions
diff --git a/atc/extern.c b/atc/extern.c
index a96fdd47..887a8cf9 100644
--- a/atc/extern.c
+++ b/atc/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.7 2003/08/07 09:36:53 agc Exp $ */
+/* $NetBSD: extern.c,v 1.8 2005/07/01 00:48:34 jmc 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.7 2003/08/07 09:36:53 agc Exp $");
+__RCSID("$NetBSD: extern.c,v 1.8 2005/07/01 00:48:34 jmc Exp $");
#endif
#endif /* not lint */
@@ -56,7 +56,7 @@ char GAMES[] = "Game_List";
int clck, safe_planes, start_time, test_mode;
-const char *file;
+const char *filename;
FILE *filein, *fileout;
diff --git a/atc/extern.h b/atc/extern.h
index c2706d2c..971a2970 100644
--- a/atc/extern.h
+++ b/atc/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.11 2004/01/27 20:30:28 jsm Exp $ */
+/* $NetBSD: extern.h,v 1.12 2005/07/01 00:48:34 jmc Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -44,7 +44,7 @@
*/
extern char GAMES[];
-extern const char *file;
+extern const char *filename;
extern int clck, safe_planes, start_time, test_mode;
@@ -70,7 +70,7 @@ int checkdefs(void);
int compar(const void *, const void *);
void delete(LIST *, PLANE *);
int dir_deg(int);
-int dir_no(char);
+int dir_no(int);
void done_screen(void);
void draw_all(void);
void draw_line(WINDOW *, int, int, int, int, const char *);
@@ -92,7 +92,7 @@ int main(int, char *[]);
char name(const PLANE *);
int next_plane(void);
void noise(void);
-int number(char);
+int number(int);
void open_score_file(void);
void planewin(void);
int pop(void);
@@ -109,30 +109,30 @@ int yylex(void);
#ifndef YYEMPTY
int yyparse(void);
#endif
-const char *Left(char);
-const char *Right(char);
-const char *airport(char);
-const char *beacon(char);
-const char *benum(char);
-const char *circle(char);
-const char *climb(char);
+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(char);
-const char *descend(char);
-const char *ex_it(char);
+const char *delayb(int);
+const char *descend(int);
+const char *ex_it(int);
PLANE *findplane(int);
-const char *ignore(char);
-const char *left(char);
-const char *mark(char);
+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(char);
-const char *right(char);
-const char *setalt(char);
-const char *setplane(char);
-const char *setrelalt(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(char);
-const char *turn(char);
-const char *unmark(char);
+const char *to_dir(int);
+const char *turn(int);
+const char *unmark(int);
diff --git a/atc/grammar.y b/atc/grammar.y
index 2d82da53..5b37eaae 100644
--- a/atc/grammar.y
+++ b/atc/grammar.y
@@ -1,4 +1,4 @@
-/* $NetBSD: grammar.y,v 1.8 2003/08/07 09:36:54 agc Exp $ */
+/* $NetBSD: grammar.y,v 1.9 2005/07/01 00:48:34 jmc Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -64,7 +64,7 @@
#if 0
static char sccsid[] = "@(#)grammar.y 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: grammar.y,v 1.8 2003/08/07 09:36:54 agc Exp $");
+__RCSID("$NetBSD: grammar.y,v 1.9 2005/07/01 00:48:34 jmc Exp $");
#endif
#endif /* not lint */
@@ -285,8 +285,7 @@ Lline:
%%
void
-check_edge(x, y)
- int x, y;
+check_edge(int x, int y)
{
if (!(x == 0) && !(x == sp->width - 1) &&
!(y == 0) && !(y == sp->height - 1))
@@ -294,8 +293,7 @@ check_edge(x, y)
}
void
-check_point(x, y)
- int x, y;
+check_point(int x, int y)
{
if (x < 1 || x >= sp->width - 1)
yyerror("X value out of range.");
@@ -304,8 +302,7 @@ check_point(x, y)
}
void
-check_linepoint(x, y)
- int x, y;
+check_linepoint(int x, int y)
{
if (x < 0 || x >= sp->width)
yyerror("X value out of range.");
@@ -314,34 +311,31 @@ check_linepoint(x, y)
}
void
-check_line(x1, y1, x2, y2)
- int x1, y1, x2, y2;
+check_line(int px1, int py1, int px2, int py2)
{
int d1, d2;
- check_linepoint(x1, y1);
- check_linepoint(x2, y2);
+ check_linepoint(px1, py1);
+ check_linepoint(px2, py2);
- d1 = ABS(x2 - x1);
- d2 = ABS(y2 - y1);
+ d1 = ABS(px2 - px1);
+ d2 = ABS(py2 - py1);
if (!(d1 == d2) && !(d1 == 0) && !(d2 == 0))
yyerror("Bad line endpoints.");
}
int
-yyerror(s)
- const char *s;
+yyerror(const char *s)
{
- fprintf(stderr, "\"%s\": line %d: %s\n", file, line, s);
+ fprintf(stderr, "\"%s\": line %d: %s\n", filename, line, s);
errors++;
return (errors);
}
void
-check_edir(x, y, dir)
- int x, y, dir;
+check_edir(int x, int y, int dir)
{
int bad = 0;
@@ -373,27 +367,27 @@ check_edir(x, y, dir)
}
int
-checkdefs()
+checkdefs(void)
{
- int err = 0;
+ int error = 0;
if (sp->width == 0) {
yyerror("'width' undefined.");
- err++;
+ error++;
}
if (sp->height == 0) {
yyerror("'height' undefined.");
- err++;
+ error++;
}
if (sp->update_secs == 0) {
yyerror("'update' undefined.");
- err++;
+ error++;
}
if (sp->newplane_time == 0) {
yyerror("'newplane' undefined.");
- err++;
+ error++;
}
- if (err)
+ if (error)
return (-1);
else
return (0);
diff --git a/atc/graphics.c b/atc/graphics.c
index eb34c23d..c0b908d6 100644
--- a/atc/graphics.c
+++ b/atc/graphics.c
@@ -1,4 +1,4 @@
-/* $NetBSD: graphics.c,v 1.10 2003/08/07 09:36:54 agc Exp $ */
+/* $NetBSD: graphics.c,v 1.11 2005/07/01 00:48:34 jmc 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.10 2003/08/07 09:36:54 agc Exp $");
+__RCSID("$NetBSD: graphics.c,v 1.11 2005/07/01 00:48:34 jmc Exp $");
#endif
#endif /* not lint */
@@ -63,7 +63,7 @@ __RCSID("$NetBSD: graphics.c,v 1.10 2003/08/07 09:36:54 agc Exp $");
WINDOW *radar, *cleanradar, *credit, *input, *planes;
int
-getAChar()
+getAChar(void)
{
int c;
@@ -76,7 +76,7 @@ getAChar()
}
void
-erase_all()
+erase_all(void)
{
PLANE *pp;
@@ -91,7 +91,7 @@ erase_all()
}
void
-draw_all()
+draw_all(void)
{
PLANE *pp;
@@ -111,7 +111,7 @@ draw_all()
}
void
-init_gr()
+init_gr(void)
{
static char buffer[BUFSIZ];
@@ -124,8 +124,7 @@ init_gr()
}
void
-setup_screen(scp)
- const C_SCREEN *scp;
+setup_screen(const C_SCREEN *scp)
{
int i, j;
char str[3];
@@ -217,10 +216,7 @@ setup_screen(scp)
}
void
-draw_line(w, x, y, lx, ly, s)
- WINDOW *w;
- int x, y, lx, ly;
- const char *s;
+draw_line(WINDOW *w, int x, int y, int lx, int ly, const char *s)
{
int dx, dy;
@@ -237,8 +233,7 @@ draw_line(w, x, y, lx, ly, s)
}
void
-ioclrtoeol(pos)
- int pos;
+ioclrtoeol(int pos)
{
wmove(input, 0, pos);
wclrtoeol(input);
@@ -247,8 +242,7 @@ ioclrtoeol(pos)
}
void
-iomove(pos)
- int pos;
+iomove(int pos)
{
wmove(input, 0, pos);
wrefresh(input);
@@ -256,9 +250,7 @@ iomove(pos)
}
void
-ioaddstr(pos, str)
- int pos;
- const char *str;
+ioaddstr(int pos, const char *str)
{
wmove(input, 0, pos);
waddstr(input, str);
@@ -267,7 +259,7 @@ ioaddstr(pos, str)
}
void
-ioclrtobot()
+ioclrtobot(void)
{
wclrtobot(input);
wrefresh(input);
@@ -275,9 +267,7 @@ ioclrtobot()
}
void
-ioerror(pos, len, str)
- int pos, len;
- const char *str;
+ioerror(int pos, int len, const char *str)
{
int i;
@@ -291,8 +281,7 @@ ioerror(pos, len, str)
}
void
-quit(dummy)
- int dummy __attribute__((__unused__));
+quit(int dummy __attribute__((__unused__)))
{
int c, y, x;
#ifdef BSD
@@ -332,7 +321,7 @@ quit(dummy)
}
void
-planewin()
+planewin(void)
{
PLANE *pp;
int warning = 0;
@@ -375,9 +364,7 @@ planewin()
}
void
-loser(p, s)
- const PLANE *p;
- const char *s;
+loser(const PLANE *p, const char *s)
{
int c;
#ifdef BSD
@@ -400,8 +387,8 @@ loser(p, s)
if (p == NULL)
wprintw(input, "%s\n\nHit space for top players list...", s);
else
- wprintw(input, "Plane '%c' %s\n\nHit space for top players list...",
- name(p), s);
+ wprintw(input, "Plane '%c' %s\n\n", name(p), s);
+ wprintw(input, "Hit space for top players list...");
wrefresh(input);
fflush(stdout);
while ((c = getchar()) != EOF && c != ' ')
@@ -414,7 +401,7 @@ loser(p, s)
}
void
-redraw()
+redraw(void)
{
clear();
refresh();
@@ -433,7 +420,7 @@ redraw()
}
void
-done_screen()
+done_screen(void)
{
clear();
refresh();
diff --git a/atc/input.c b/atc/input.c
index 68cfe758..9f4f6339 100644
--- a/atc/input.c
+++ b/atc/input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: input.c,v 1.17 2005/02/15 12:56:20 jsm Exp $ */
+/* $NetBSD: input.c,v 1.18 2005/07/01 00:48:34 jmc Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: input.c,v 1.17 2005/02/15 12:56:20 jsm Exp $");
+__RCSID("$NetBSD: input.c,v 1.18 2005/07/01 00:48:34 jmc Exp $");
#endif
#endif /* not lint */
@@ -67,7 +67,7 @@ typedef struct {
int token;
int to_state;
const char *str;
- const char *(*func)(char);
+ const char *(*func)(int);
} RULE;
typedef struct {
@@ -175,7 +175,7 @@ int tval;
int dest_type, dest_no, dir;
int
-pop()
+pop(void)
{
if (level == 0)
return (-1);
@@ -190,7 +190,7 @@ pop()
}
void
-rezero()
+rezero(void)
{
iomove(0);
@@ -203,8 +203,7 @@ rezero()
}
void
-push(ruleno, ch)
- int ruleno, ch;
+push(int ruleno, int ch)
{
int newstate, newpos;
@@ -226,10 +225,10 @@ push(ruleno, ch)
}
int
-getcommand()
+getcommand(void)
{
int c, i, done;
- const char *s, *(*func)(char);
+ const char *s, *(*func)(int);
PLANE *pp;
rezero();
@@ -285,14 +284,14 @@ getcommand()
}
void
-noise()
+noise(void)
{
putchar('\07');
fflush(stdout);
}
int
-gettoken()
+gettoken(void)
{
while ((tval = getAChar()) == REDRAWTOKEN || tval == SHELLTOKEN)
{
@@ -354,9 +353,8 @@ gettoken()
return (tval);
}
-const char *
-setplane(c)
- char c;
+const char *
+setplane(int c)
{
PLANE *pp;
@@ -368,18 +366,16 @@ setplane(c)
return (NULL);
}
-const char *
-turn(c)
- char c __attribute__((__unused__));
+const char *
+turn(int c __attribute__((__unused__)))
{
if (p.altitude == 0)
return ("Planes at airports may not change direction");
return (NULL);
}
-const char *
-circle(c)
- char c __attribute__((__unused__));
+const char *
+circle(int c __attribute__((__unused__)))
{
if (p.altitude == 0)
return ("Planes cannot circle on the ground");
@@ -387,9 +383,8 @@ circle(c)
return (NULL);
}
-const char *
-left(c)
- char c __attribute__((__unused__));
+const char *
+left(int c __attribute__((__unused__)))
{
dir = D_LEFT;
p.new_dir = p.dir - 1;
@@ -398,9 +393,8 @@ left(c)
return (NULL);
}
-const char *
-right(c)
- char c __attribute__((__unused__));
+const char *
+right(int c __attribute__((__unused__)))
{
dir = D_RIGHT;
p.new_dir = p.dir + 1;
@@ -409,9 +403,8 @@ right(c)
return (NULL);
}
-const char *
-Left(c)
- char c __attribute__((__unused__));
+const char *
+Left(int c __attribute__((__unused__)))
{
p.new_dir = p.dir - 2;
if (p.new_dir < 0)
@@ -419,9 +412,8 @@ Left(c)
return (NULL);
}
-const char *
-Right(c)
- char c __attribute__((__unused__));
+const char *
+Right(int c __attribute__((__unused__)))
{
p.new_dir = p.dir + 2;
if (p.new_dir >= MAXDIR)
@@ -429,9 +421,8 @@ Right(c)
return (NULL);
}
-const char *
-delayb(c)
- char c;
+const char *
+delayb(int c)
{
int xdiff, ydiff;
@@ -475,49 +466,43 @@ delayb(c)
return (NULL);
}
-const char *
-beacon(c)
- char c __attribute__((__unused__));
+const char *
+beacon(int c __attribute__((__unused__)))
{
dest_type = T_BEACON;
return (NULL);
}
-const char *
-ex_it(c)
- char c __attribute__((__unused__));
+const char *
+ex_it(int c __attribute__((__unused__)))
{
dest_type = T_EXIT;
return (NULL);
}
-const char *
-airport(c)
- char c __attribute__((__unused__));
+const char *
+airport(int c __attribute__((__unused__)))
{
dest_type = T_AIRPORT;
return (NULL);
}
-const char *
-climb(c)
- char c __attribute__((__unused__));
+const char *
+climb(int c __attribute__((__unused__)))
{
dir = D_UP;
return (NULL);
}
-const char *
-descend(c)
- char c __attribute__((__unused__));
+const char *
+descend(int c __attribute__((__unused__)))
{
dir = D_DOWN;
return (NULL);
}
-const char *
-setalt(c)
- char c;
+const char *
+setalt(int c)
{
if ((p.altitude == c - '0') && (p.new_altitude == p.altitude))
return ("Already at that altitude");
@@ -525,9 +510,8 @@ setalt(c)
return (NULL);
}
-const char *
-setrelalt(c)
- char c;
+const char *
+setrelalt(int c)
{
if (c == 0)
return ("altitude not changed");
@@ -550,9 +534,8 @@ setrelalt(c)
return (NULL);
}
-const char *
-benum(c)
- char c;
+const char *
+benum(int c)
{
dest_no = c -= '0';
@@ -582,17 +565,15 @@ benum(c)
return (NULL);
}
-const char *
-to_dir(c)
- char c;
+const char *
+to_dir(int c)
{
p.new_dir = dir_no(c);
return (NULL);
}
-const char *
-rel_dir(c)
- char c;
+const char *
+rel_dir(int c)
{
int angle;
@@ -615,9 +596,8 @@ rel_dir(c)
return (NULL);
}
-const char *
-mark(c)
- char c __attribute__((__unused__));
+const char *
+mark(int c __attribute__((__unused__)))
{
if (p.altitude == 0)
return ("Cannot mark planes on the ground");
@@ -627,9 +607,8 @@ mark(c)
return (NULL);
}
-const char *
-unmark(c)
- char c __attribute__((__unused__));
+const char *
+unmark(int c __attribute__((__unused__)))
{
if (p.altitude == 0)
return ("Cannot unmark planes on the ground");
@@ -639,9 +618,8 @@ unmark(c)
return (NULL);
}
-const char *
-ignore(c)
- char c __attribute__((__unused__));
+const char *
+ignore(int c __attribute__((__unused__)))
{
if (p.altitude == 0)
return ("Cannot ignore planes on the ground");
@@ -652,24 +630,23 @@ ignore(c)
}
int
-dir_no(ch)
- char ch;
+dir_no(int ch)
{
- int dir;
+ int dirno;
- dir = -1;
+ dirno = -1;
switch (ch) {
- case 'w': dir = 0; break;
- case 'e': dir = 1; break;
- case 'd': dir = 2; break;
- case 'c': dir = 3; break;
- case 'x': dir = 4; break;
- case 'z': dir = 5; break;
- case 'a': dir = 6; break;
- case 'q': dir = 7; break;
+ case 'w': dirno = 0; break;
+ case 'e': dirno = 1; break;
+ case 'd': dirno = 2; break;
+ case 'c': dirno = 3; break;
+ case 'x': dirno = 4; break;
+ case 'z': dirno = 5; break;
+ case 'a': dirno = 6; break;
+ case 'q': dirno = 7; break;
default:
fprintf(stderr, "bad character in dir_no\n");
break;
}
- return (dir);
+ return (dirno);
}
diff --git a/atc/list.c b/atc/list.c
index e1b50b13..e6012081 100644
--- a/atc/list.c
+++ b/atc/list.c
@@ -1,4 +1,4 @@
-/* $NetBSD: list.c,v 1.6 2003/08/07 09:36:54 agc Exp $ */
+/* $NetBSD: list.c,v 1.7 2005/07/01 00:48:34 jmc Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,22 +46,20 @@
#if 0
static char sccsid[] = "@(#)list.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: list.c,v 1.6 2003/08/07 09:36:54 agc Exp $");
+__RCSID("$NetBSD: list.c,v 1.7 2005/07/01 00:48:34 jmc Exp $");
#endif
#endif /* not lint */
#include "include.h"
-PLANE *
-newplane()
+PLANE *
+newplane(void)
{
return ((PLANE *) calloc(1, sizeof (PLANE)));
}
void
-append(l, p)
- LIST *l;
- PLANE *p;
+append(LIST *l, PLANE *p)
{
PLANE *q = NULL, *r = NULL;
@@ -98,9 +96,7 @@ append(l, p)
}
void
-delete(l, p)
- LIST *l;
- PLANE *p;
+delete(LIST *l, PLANE *p)
{
if (l->head == NULL)
loser(p, "deleted a non-existent plane! Get help!");
diff --git a/atc/log.c b/atc/log.c
index a92aaae5..2d29e2d5 100644
--- a/atc/log.c
+++ b/atc/log.c
@@ -1,4 +1,4 @@
-/* $NetBSD: log.c,v 1.13 2004/09/07 13:20:39 jrf Exp $ */
+/* $NetBSD: log.c,v 1.14 2005/07/01 00:48:34 jmc 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.13 2004/09/07 13:20:39 jrf Exp $");
+__RCSID("$NetBSD: log.c,v 1.14 2005/07/01 00:48:34 jmc Exp $");
#endif
#endif /* not lint */
@@ -56,8 +56,7 @@ __RCSID("$NetBSD: log.c,v 1.13 2004/09/07 13:20:39 jrf Exp $");
static FILE *score_fp;
int
-compar(va, vb)
- const void *va, *vb;
+compar(const void *va, const void *vb)
{
const SCORE *a, *b;
@@ -79,9 +78,8 @@ compar(va, vb)
#define MIN(t) (((t) % SECAHOUR) / SECAMIN)
#define SEC(t) ((t) % SECAMIN)
-const char *
-timestr(t)
- int t;
+const char *
+timestr(int t)
{
static char s[80];
@@ -100,7 +98,7 @@ timestr(t)
}
void
-open_score_file()
+open_score_file(void)
{
mode_t old_mask;
int score_fd;
@@ -135,14 +133,13 @@ open_score_file()
}
int
-log_score(list_em)
- int list_em;
+log_score(int list_em)
{
int i, num_scores = 0, good, changed = 0, found = 0;
struct passwd *pw;
char *cp;
SCORE score[100], thisscore;
- struct utsname name;
+ struct utsname lname;
long offset;
if (score_fp == NULL) {
@@ -179,12 +176,13 @@ log_score(list_em)
return (-1);
}
strcpy(thisscore.name, pw->pw_name);
- uname(&name);
- strlcpy(thisscore.host, name.nodename, sizeof(thisscore.host));
+ uname(&lname);
+ strlcpy(thisscore.host, lname.nodename, sizeof(thisscore.host));
- cp = strrchr(file, '/');
+ cp = strrchr(filename, '/');
if (cp == NULL) {
- fprintf(stderr, "log: where's the '/' in %s?\n", file);
+ fprintf(stderr, "log: where's the '/' in %s?\n",
+ filename);
return (-1);
}
cp++;
@@ -271,7 +269,8 @@ log_score(list_em)
fclose(score_fp);
printf("%2s: %-8s %-8s %-18s %4s %9s %4s\n", "#", "name", "host",
"game", "time", "real time", "planes safe");
- puts("-------------------------------------------------------------------------------");
+ puts("--------------------------------------------------------------");
+ puts("-----------------");
for (i = 0; i < num_scores; i++) {
cp = strchr(score[i].host, '.');
if (cp != NULL)
@@ -286,8 +285,7 @@ log_score(list_em)
}
void
-log_score_quit(dummy)
- int dummy __attribute__((__unused__));
+log_score_quit(int dummy __attribute__((__unused__)))
{
(void)log_score(0);
exit(0);
diff --git a/atc/main.c b/atc/main.c
index a579e89d..c69064b6 100644
--- a/atc/main.c
+++ b/atc/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.13 2003/08/07 09:36:54 agc Exp $ */
+/* $NetBSD: main.c,v 1.14 2005/07/01 00:48:34 jmc Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: main.c,v 1.13 2003/08/07 09:36:54 agc Exp $");
+__RCSID("$NetBSD: main.c,v 1.14 2005/07/01 00:48:34 jmc Exp $");
#endif
#endif /* not lint */
@@ -61,9 +61,7 @@ __RCSID("$NetBSD: main.c,v 1.13 2003/08/07 09:36:54 agc Exp $");
extern FILE *yyin;
int
-main(ac, av)
- int ac;
- char *av[];
+main(int argc, char *argv[])
{
int seed;
int f_usage = 0, f_list = 0, f_showscore = 0;
@@ -81,7 +79,7 @@ main(ac, av)
start_time = seed = time(NULL);
- while ((ch = getopt(ac, av, "ulstpg:f:r:")) != -1) {
+ while ((ch = getopt(argc, argv, "ulstpg:f:r:")) != -1) {
switch (ch) {
case '?':
case 'u':
@@ -107,14 +105,14 @@ main(ac, av)
break;
}
}
- if (optind < ac)
+ if (optind < argc)
f_usage++;
srandom(seed);
if (f_usage)
fprintf(stderr,
"Usage: %s -[u?lstp] [-[gf] game_name] [-r random seed]\n",
- av[0]);
+ argv[0]);
if (f_showscore)
log_score(1);
if (f_list)
@@ -208,12 +206,11 @@ main(ac, av)
}
int
-read_file(s)
- const char *s;
+read_file(const char *s)
{
int retval;
- file = s;
+ filename = s;
yyin = fopen(s, "r");
if (yyin == NULL) {
warn("fopen %s", s);
@@ -228,8 +225,8 @@ read_file(s)
return (0);
}
-const char *
-default_game()
+const char *
+default_game(void)
{
FILE *fp;
static char file[256];
@@ -253,9 +250,8 @@ default_game()
return (file);
}
-const char *
-okay_game(s)
- const char *s;
+const char *
+okay_game(const char *s)
{
FILE *fp;
static char file[256];
@@ -290,7 +286,7 @@ okay_game(s)
}
int
-list_games()
+list_games(void)
{
FILE *fp;
char line[256], games[256];
diff --git a/atc/update.c b/atc/update.c
index 3a145e5f..3b8aa728 100644
--- a/atc/update.c
+++ b/atc/update.c
@@ -1,4 +1,4 @@
-/* $NetBSD: update.c,v 1.12 2003/08/07 09:36:55 agc Exp $ */
+/* $NetBSD: update.c,v 1.13 2005/07/01 00:48:34 jmc Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,15 +46,14 @@
#if 0
static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: update.c,v 1.12 2003/08/07 09:36:55 agc Exp $");
+__RCSID("$NetBSD: update.c,v 1.13 2005/07/01 00:48:34 jmc Exp $");
#endif
#endif /* not lint */
#include "include.h"
void
-update(dummy)
- int dummy __attribute__((__unused__));
+update(int dummy __attribute__((__unused__)))
{
int i, dir_diff, unclean;
PLANE *pp, *p1, *p2;
@@ -219,8 +218,7 @@ update(dummy)
}
const char *
-command(pp)
- const PLANE *pp;
+command(const PLANE *pp)
{
static char buf[50], *bp, *comm_start;
@@ -250,8 +248,7 @@ command(pp)
}
char
-name(p)
- const PLANE *p;
+name(const PLANE *p)
{
if (p->plane_type == 0)
return ('A' + p->plane_no);
@@ -260,8 +257,7 @@ name(p)
}
int
-number(l)
- char l;
+number(int l)
{
if (l < 'a' && l > 'z' && l < 'A' && l > 'Z')
return (-1);
@@ -272,7 +268,7 @@ number(l)
}
int
-next_plane()
+next_plane(void)
{
static int last_plane = -1;
PLANE *pp;
@@ -301,10 +297,10 @@ next_plane()
}
int
-addplane()
+addplane(void)
{
PLANE p, *pp, *p1;
- int i, num_starts, close, rnd, rnd2, pnum;
+ int i, num_starts, isclose, rnd, rnd2, pnum;
memset(&p, 0, sizeof (p));
@@ -334,13 +330,13 @@ addplane()
p.ypos = sp->exit[rnd2].y;
p.new_dir = p.dir = sp->exit[rnd2].dir;
p.altitude = p.new_altitude = 7;
- close = 0;
+ isclose = 0;
for (p1 = air.head; p1 != NULL; p1 = p1->next)
if (too_close(p1, &p, 4)) {
- close++;
+ isclose++;
break;
}
- if (close)
+ if (isclose)
continue;
} else {
p.orig_type = T_AIRPORT;
@@ -373,9 +369,8 @@ addplane()
return (pp->dest_type);
}
-PLANE *
-findplane(n)
- int n;
+PLANE *
+findplane(int n)
{
PLANE *pp;
@@ -389,20 +384,18 @@ findplane(n)
}
int
-too_close(p1, p2, dist)
- const PLANE *p1, *p2;
- int dist;
+too_close(const PLANE *p1, const PLANE *p2, int dist)
{
if (ABS(p1->altitude - p2->altitude) <= dist &&
- ABS(p1->xpos - p2->xpos) <= dist && ABS(p1->ypos - p2->ypos) <= dist)
+ ABS(p1->xpos - p2->xpos) <= dist &&
+ ABS(p1->ypos - p2->ypos) <= dist)
return (1);
else
return (0);
}
int
-dir_deg(d)
- int d;
+dir_deg(int d)
{
switch (d) {
case 0: return (0);