summaryrefslogtreecommitdiffstats
path: root/atc
diff options
context:
space:
mode:
authorrpaulo <rpaulo@NetBSD.org>2005-08-10 17:53:28 +0000
committerrpaulo <rpaulo@NetBSD.org>2005-08-10 17:53:28 +0000
commit90f5663ccbe92953f9eea2ee004653a52ca7196d (patch)
tree996bc7af369386ac6a6124503f59ca2e091e8b19 /atc
parent5f15bd7b70cf1b2c91e6ca76b4f0a47e4778a3dd (diff)
downloadbsdgames-darwin-90f5663ccbe92953f9eea2ee004653a52ca7196d.tar.gz
bsdgames-darwin-90f5663ccbe92953f9eea2ee004653a52ca7196d.tar.zst
bsdgames-darwin-90f5663ccbe92953f9eea2ee004653a52ca7196d.zip
Pass lint(1).
Diffstat (limited to 'atc')
-rw-r--r--atc/extern.c6
-rw-r--r--atc/extern.h4
-rw-r--r--atc/graphics.c252
-rw-r--r--atc/input.c54
-rw-r--r--atc/log.c94
-rw-r--r--atc/main.c94
-rw-r--r--atc/update.c15
7 files changed, 271 insertions, 248 deletions
diff --git a/atc/extern.c b/atc/extern.c
index 887a8cf9..9c946d3d 100644
--- a/atc/extern.c
+++ b/atc/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.8 2005/07/01 00:48:34 jmc Exp $ */
+/* $NetBSD: extern.c,v 1.9 2005/08/10 17:53:28 rpaulo 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.8 2005/07/01 00:48:34 jmc Exp $");
+__RCSID("$NetBSD: extern.c,v 1.9 2005/08/10 17:53:28 rpaulo Exp $");
#endif
#endif /* not lint */
@@ -58,7 +58,9 @@ int clck, safe_planes, start_time, test_mode;
const char *filename;
+#if 0
FILE *filein, *fileout;
+#endif
C_SCREEN screen, *sp = &screen;
diff --git a/atc/extern.h b/atc/extern.h
index 971a2970..0e9cca5a 100644
--- a/atc/extern.h
+++ b/atc/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.12 2005/07/01 00:48:34 jmc Exp $ */
+/* $NetBSD: extern.h,v 1.13 2005/08/10 17:53:28 rpaulo Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -48,7 +48,9 @@ extern const char *filename;
extern int clck, safe_planes, start_time, test_mode;
+#if 0
extern FILE *filein, *fileout;
+#endif
extern C_SCREEN screen, *sp;
diff --git a/atc/graphics.c b/atc/graphics.c
index c0b908d6..5f844804 100644
--- a/atc/graphics.c
+++ b/atc/graphics.c
@@ -1,4 +1,4 @@
-/* $NetBSD: graphics.c,v 1.11 2005/07/01 00:48:34 jmc Exp $ */
+/* $NetBSD: graphics.c,v 1.12 2005/08/10 17:53:28 rpaulo 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.11 2005/07/01 00:48:34 jmc Exp $");
+__RCSID("$NetBSD: graphics.c,v 1.12 2005/08/10 17:53:28 rpaulo Exp $");
#endif
#endif /* not lint */
@@ -81,12 +81,12 @@ erase_all(void)
PLANE *pp;
for (pp = air.head; pp != NULL; pp = pp->next) {
- wmove(cleanradar, pp->ypos, pp->xpos * 2);
- wmove(radar, pp->ypos, pp->xpos * 2);
- waddch(radar, winch(cleanradar));
- wmove(cleanradar, pp->ypos, pp->xpos * 2 + 1);
- wmove(radar, pp->ypos, pp->xpos * 2 + 1);
- waddch(radar, winch(cleanradar));
+ (void)wmove(cleanradar, pp->ypos, pp->xpos * 2);
+ (void)wmove(radar, pp->ypos, pp->xpos * 2);
+ (void)waddch(radar, winch(cleanradar));
+ (void)wmove(cleanradar, pp->ypos, pp->xpos * 2 + 1);
+ (void)wmove(radar, pp->ypos, pp->xpos * 2 + 1);
+ (void)waddch(radar, winch(cleanradar));
}
}
@@ -97,17 +97,17 @@ draw_all(void)
for (pp = air.head; pp != NULL; pp = pp->next) {
if (pp->status == S_MARKED)
- wstandout(radar);
- wmove(radar, pp->ypos, pp->xpos * 2);
- waddch(radar, name(pp));
- waddch(radar, '0' + pp->altitude);
+ (void)wstandout(radar);
+ (void)wmove(radar, pp->ypos, pp->xpos * 2);
+ (void)waddch(radar, name(pp));
+ (void)waddch(radar, '0' + pp->altitude);
if (pp->status == S_MARKED)
- wstandend(radar);
+ (void)wstandend(radar);
}
- wrefresh(radar);
- planewin();
- wrefresh(input); /* return cursor */
- fflush(stdout);
+ (void)wrefresh(radar);
+ (void)planewin();
+ (void)wrefresh(input); /* return cursor */
+ (void)fflush(stdout);
}
void
@@ -115,7 +115,7 @@ init_gr(void)
{
static char buffer[BUFSIZ];
- initscr();
+ (void)initscr();
setbuf(stdout, buffer);
input = newwin(INPUT_LINES, COLS - PLANE_COLS, LINES - INPUT_LINES, 0);
credit = newwin(INPUT_LINES, PLANE_COLS, LINES - INPUT_LINES,
@@ -133,27 +133,27 @@ setup_screen(const C_SCREEN *scp)
str[2] = '\0';
if (radar != NULL)
- delwin(radar);
+ (void)delwin(radar);
radar = newwin(scp->height, scp->width * 2, 0, 0);
if (cleanradar != NULL)
- delwin(cleanradar);
+ (void)delwin(cleanradar);
cleanradar = newwin(scp->height, scp->width * 2, 0, 0);
/* minus one here to prevent a scroll */
for (i = 0; i < PLANE_COLS - 1; i++) {
- wmove(credit, 0, i);
- waddch(credit, C_CREDIT);
- wmove(credit, INPUT_LINES - 1, i);
- waddch(credit, C_CREDIT);
+ (void)wmove(credit, 0, i);
+ (void)waddch(credit, C_CREDIT);
+ (void)wmove(credit, INPUT_LINES - 1, i);
+ (void)waddch(credit, C_CREDIT);
}
- wmove(credit, INPUT_LINES / 2, 1);
- waddstr(credit, AUTHOR_STR);
+ (void)wmove(credit, INPUT_LINES / 2, 1);
+ (void)waddstr(credit, AUTHOR_STR);
for (i = 1; i < scp->height - 1; i++) {
for (j = 1; j < scp->width - 1; j++) {
- wmove(radar, i, j * 2);
- waddch(radar, C_BACKROUND);
+ (void)wmove(radar, i, j * 2);
+ (void)waddch(radar, C_BACKROUND);
}
}
@@ -170,49 +170,49 @@ setup_screen(const C_SCREEN *scp)
str[0] = C_TOPBOTTOM;
str[1] = C_TOPBOTTOM;
- wmove(radar, 0, 0);
+ (void)wmove(radar, 0, 0);
for (i = 0; i < scp->width - 1; i++)
- waddstr(radar, str);
- waddch(radar, C_TOPBOTTOM);
+ (void)waddstr(radar, str);
+ (void)waddch(radar, C_TOPBOTTOM);
str[0] = C_TOPBOTTOM;
str[1] = C_TOPBOTTOM;
- wmove(radar, scp->height - 1, 0);
+ (void)wmove(radar, scp->height - 1, 0);
for (i = 0; i < scp->width - 1; i++)
- waddstr(radar, str);
- waddch(radar, C_TOPBOTTOM);
+ (void)waddstr(radar, str);
+ (void)waddch(radar, C_TOPBOTTOM);
for (i = 1; i < scp->height - 1; i++) {
- wmove(radar, i, 0);
- waddch(radar, C_LEFTRIGHT);
- wmove(radar, i, (scp->width - 1) * 2);
- waddch(radar, C_LEFTRIGHT);
+ (void)wmove(radar, i, 0);
+ (void)waddch(radar, C_LEFTRIGHT);
+ (void)wmove(radar, i, (scp->width - 1) * 2);
+ (void)waddch(radar, C_LEFTRIGHT);
}
str[0] = C_BEACON;
for (i = 0; i < scp->num_beacons; i++) {
str[1] = '0' + i;
- wmove(radar, scp->beacon[i].y, scp->beacon[i].x * 2);
- waddstr(radar, str);
+ (void)wmove(radar, scp->beacon[i].y, scp->beacon[i].x * 2);
+ (void)waddstr(radar, str);
}
for (i = 0; i < scp->num_exits; i++) {
- wmove(radar, scp->exit[i].y, scp->exit[i].x * 2);
- waddch(radar, '0' + i);
+ (void)wmove(radar, scp->exit[i].y, scp->exit[i].x * 2);
+ (void)waddch(radar, '0' + i);
}
airstr = "^?>?v?<?";
for (i = 0; i < scp->num_airports; i++) {
str[0] = airstr[scp->airport[i].dir];
str[1] = '0' + i;
- wmove(radar, scp->airport[i].y, scp->airport[i].x * 2);
- waddstr(radar, str);
+ (void)wmove(radar, scp->airport[i].y, scp->airport[i].x * 2);
+ (void)waddstr(radar, str);
}
- overwrite(radar, cleanradar);
- wrefresh(radar);
- wrefresh(credit);
- fflush(stdout);
+ (void)overwrite(radar, cleanradar);
+ (void)wrefresh(radar);
+ (void)wrefresh(credit);
+ (void)fflush(stdout);
}
void
@@ -223,8 +223,8 @@ draw_line(WINDOW *w, int x, int y, int lx, int ly, const char *s)
dx = SGN(lx - x);
dy = SGN(ly - y);
for (;;) {
- wmove(w, y, x * 2);
- waddstr(w, s);
+ (void)wmove(w, y, x * 2);
+ (void)waddstr(w, s);
if (x == lx && y == ly)
break;
x += dx;
@@ -235,35 +235,35 @@ draw_line(WINDOW *w, int x, int y, int lx, int ly, const char *s)
void
ioclrtoeol(int pos)
{
- wmove(input, 0, pos);
- wclrtoeol(input);
- wrefresh(input);
- fflush(stdout);
+ (void)wmove(input, 0, pos);
+ (void)wclrtoeol(input);
+ (void)wrefresh(input);
+ (void)fflush(stdout);
}
void
iomove(int pos)
{
- wmove(input, 0, pos);
- wrefresh(input);
- fflush(stdout);
+ (void)wmove(input, 0, pos);
+ (void)wrefresh(input);
+ (void)fflush(stdout);
}
void
ioaddstr(int pos, const char *str)
{
- wmove(input, 0, pos);
- waddstr(input, str);
- wrefresh(input);
- fflush(stdout);
+ (void)wmove(input, 0, pos);
+ (void)waddstr(input, str);
+ (void)wrefresh(input);
+ (void)fflush(stdout);
}
void
ioclrtobot(void)
{
- wclrtobot(input);
- wrefresh(input);
- fflush(stdout);
+ (void)wclrtobot(input);
+ (void)wrefresh(input);
+ (void)fflush(stdout);
}
void
@@ -271,15 +271,16 @@ ioerror(int pos, int len, const char *str)
{
int i;
- wmove(input, 1, pos);
+ (void)wmove(input, 1, pos);
for (i = 0; i < len; i++)
- waddch(input, '^');
- wmove(input, 2, 0);
- waddstr(input, str);
- wrefresh(input);
- fflush(stdout);
+ (void)waddch(input, '^');
+ (void)wmove(input, 2, 0);
+ (void)waddstr(input, str);
+ (void)wrefresh(input);
+ (void)fflush(stdout);
}
+/* ARGSUSED */
void
quit(int dummy __attribute__((__unused__)))
{
@@ -289,11 +290,11 @@ quit(int dummy __attribute__((__unused__)))
#endif
getyx(input, y, x);
- wmove(input, 2, 0);
- waddstr(input, "Really quit? (y/n) ");
- wclrtobot(input);
- wrefresh(input);
- fflush(stdout);
+ (void)wmove(input, 2, 0);
+ (void)waddstr(input, "Really quit? (y/n) ");
+ (void)wclrtobot(input);
+ (void)wrefresh(input);
+ (void)fflush(stdout);
c = getchar();
if (c == EOF || c == 'y') {
@@ -301,23 +302,23 @@ quit(int dummy __attribute__((__unused__)))
#ifdef BSD
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
+ (void)setitimer(ITIMER_REAL, &itv, NULL);
#endif
#ifdef SYSV
alarm(0);
#endif
- fflush(stdout);
- clear();
- refresh();
- endwin();
- log_score(0);
+ (void)fflush(stdout);
+ (void)clear();
+ (void)refresh();
+ (void)endwin();
+ (void)log_score(0);
exit(0);
}
- wmove(input, 2, 0);
- wclrtobot(input);
- wmove(input, y, x);
- wrefresh(input);
- fflush(stdout);
+ (void)wmove(input, 2, 0);
+ (void)wclrtobot(input);
+ (void)wmove(input, y, x);
+ (void)wrefresh(input);
+ (void)fflush(stdout);
}
void
@@ -327,40 +328,40 @@ planewin(void)
int warning = 0;
#ifdef BSD
- wclear(planes);
+ (void)wclear(planes);
#endif
- wmove(planes, 0,0);
+ (void)wmove(planes, 0,0);
#ifdef SYSV
wclrtobot(planes);
#endif
- wprintw(planes, "Time: %-4d Safe: %d", clck, safe_planes);
- wmove(planes, 2, 0);
+ (void)wprintw(planes, "Time: %-4d Safe: %d", clck, safe_planes);
+ (void)wmove(planes, 2, 0);
- waddstr(planes, "pl dt comm");
+ (void)waddstr(planes, "pl dt comm");
for (pp = air.head; pp != NULL; pp = pp->next) {
if (waddch(planes, '\n') == ERR) {
warning++;
break;
}
- waddstr(planes, command(pp));
+ (void)waddstr(planes, command(pp));
}
- waddch(planes, '\n');
+ (void)waddch(planes, '\n');
for (pp = ground.head; pp != NULL; pp = pp->next) {
if (waddch(planes, '\n') == ERR) {
warning++;
break;
}
- waddstr(planes, command(pp));
+ (void)waddstr(planes, command(pp));
}
if (warning) {
- wmove(planes, LINES - INPUT_LINES - 1, 0);
- waddstr(planes, "---- more ----");
- wclrtoeol(planes);
+ (void)wmove(planes, LINES - INPUT_LINES - 1, 0);
+ (void)waddstr(planes, "---- more ----");
+ (void)wclrtoeol(planes);
}
- wrefresh(planes);
- fflush(stdout);
+ (void)wrefresh(planes);
+ (void)fflush(stdout);
}
void
@@ -375,54 +376,55 @@ loser(const PLANE *p, const char *s)
#ifdef BSD
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
+ (void)setitimer(ITIMER_REAL, &itv, NULL);
#endif
#ifdef SYSV
alarm(0);
#endif
- wmove(input, 0, 0);
- wclrtobot(input);
+ (void)wmove(input, 0, 0);
+ (void)wclrtobot(input);
/* p may be NULL if we ran out of memory */
if (p == NULL)
- wprintw(input, "%s\n\nHit space for top players list...", s);
+ (void)wprintw(input, "%s\n\nHit space for top players list...",
+ s);
else
- wprintw(input, "Plane '%c' %s\n\n", name(p), s);
- wprintw(input, "Hit space for top players list...");
- wrefresh(input);
- fflush(stdout);
+ (void)wprintw(input, "Plane '%c' %s\n\n", name(p), s);
+ (void)wprintw(input, "Hit space for top players list...");
+ (void)wrefresh(input);
+ (void)fflush(stdout);
while ((c = getchar()) != EOF && c != ' ')
;
- clear(); /* move to top of screen */
- refresh();
- endwin();
- log_score(0);
+ (void)clear(); /* move to top of screen */
+ (void)refresh();
+ (void)endwin();
+ (void)log_score(0);
exit(0);
}
void
redraw(void)
{
- clear();
- refresh();
+ (void)clear();
+ (void)refresh();
- touchwin(radar);
- wrefresh(radar);
- touchwin(planes);
- wrefresh(planes);
- touchwin(credit);
- wrefresh(credit);
+ (void)touchwin(radar);
+ (void)wrefresh(radar);
+ (void)touchwin(planes);
+ (void)wrefresh(planes);
+ (void)touchwin(credit);
+ (void)wrefresh(credit);
/* refresh input last to get cursor in right place */
- touchwin(input);
- wrefresh(input);
- fflush(stdout);
+ (void)touchwin(input);
+ (void)wrefresh(input);
+ (void)fflush(stdout);
}
void
done_screen(void)
{
- clear();
- refresh();
- endwin(); /* clean up curses */
+ (void)clear();
+ (void)refresh();
+ (void)endwin(); /* clean up curses */
}
diff --git a/atc/input.c b/atc/input.c
index 9f4f6339..64b202a1 100644
--- a/atc/input.c
+++ b/atc/input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: input.c,v 1.18 2005/07/01 00:48:34 jmc Exp $ */
+/* $NetBSD: input.c,v 1.19 2005/08/10 17:53:28 rpaulo 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.18 2005/07/01 00:48:34 jmc Exp $");
+__RCSID("$NetBSD: input.c,v 1.19 2005/08/10 17:53:28 rpaulo Exp $");
#endif
#endif /* not lint */
@@ -183,7 +183,7 @@ pop(void)
ioclrtoeol(T_POS);
- strcpy(T_STR, "");
+ (void)strcpy(T_STR, "");
T_RULE = -1;
T_CH = -1;
return (0);
@@ -199,7 +199,7 @@ rezero(void)
T_RULE = -1;
T_CH = -1;
T_POS = 0;
- strcpy(T_STR, "");
+ (void)strcpy(T_STR, "");
}
void
@@ -221,7 +221,7 @@ push(int ruleno, int ch)
T_STATE = newstate;
T_POS = newpos;
T_RULE = -1;
- strcpy(T_STR, "");
+ (void)strcpy(T_STR, "");
}
int
@@ -265,7 +265,8 @@ getcommand(void)
func = st[stack[i].state].rule[stack[i].rule].func;
if (func != NULL)
if ((s = (*func)(stack[i].ch)) != NULL) {
- ioerror(stack[i].pos, strlen(stack[i].str), s);
+ ioerror(stack[i].pos,
+ (int)strlen(stack[i].str), s);
return (-1);
}
}
@@ -286,8 +287,8 @@ getcommand(void)
void
noise(void)
{
- putchar('\07');
- fflush(stdout);
+ (void)putchar('\07');
+ (void)fflush(stdout);
}
int
@@ -301,7 +302,7 @@ gettoken(void)
struct itimerval itv;
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
+ (void)setitimer(ITIMER_REAL, &itv, NULL);
#endif
#ifdef SYSV
int aval;
@@ -321,28 +322,29 @@ gettoken(void)
base = shell;
else
base++;
- execl(shell, base, (char *) 0);
+ (void)execl(shell, base, (char *) 0);
}
else
- execl(_PATH_BSHELL, "sh", (char *) 0);
+ (void)execl(_PATH_BSHELL, "sh",
+ (char *) 0);
exit(0); /* oops */
}
- wait(0);
- tcsetattr(fileno(stdin), TCSADRAIN, &tty_new);
+ (void)wait(0);
+ (void)tcsetattr(fileno(stdin), TCSADRAIN, &tty_new);
#ifdef BSD
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = 1;
itv.it_interval.tv_sec = sp->update_secs;
itv.it_interval.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
+ (void)setitimer(ITIMER_REAL, &itv, NULL);
#endif
#ifdef SYSV
alarm(aval);
#endif
}
- redraw();
+ (void)redraw();
}
if (isdigit(tval))
@@ -361,11 +363,12 @@ setplane(int c)
pp = findplane(number(c));
if (pp == NULL)
return ("Unknown Plane");
- memcpy(&p, pp, sizeof (p));
+ (void)memcpy(&p, pp, sizeof (p));
p.delayd = 0;
return (NULL);
}
+/* ARGSUSED */
const char *
turn(int c __attribute__((__unused__)))
{
@@ -374,6 +377,7 @@ turn(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
circle(int c __attribute__((__unused__)))
{
@@ -383,6 +387,7 @@ circle(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
left(int c __attribute__((__unused__)))
{
@@ -393,6 +398,7 @@ left(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
right(int c __attribute__((__unused__)))
{
@@ -403,6 +409,7 @@ right(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
Left(int c __attribute__((__unused__)))
{
@@ -412,6 +419,7 @@ Left(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
Right(int c __attribute__((__unused__)))
{
@@ -455,7 +463,6 @@ delayb(int c)
break;
default:
return ("Bad case in delayb! Get help!");
- break;
}
if (xdiff == 0 && ydiff == 0)
return ("Would already be there");
@@ -466,6 +473,7 @@ delayb(int c)
return (NULL);
}
+/* ARGSUSED */
const char *
beacon(int c __attribute__((__unused__)))
{
@@ -473,6 +481,7 @@ beacon(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
ex_it(int c __attribute__((__unused__)))
{
@@ -480,6 +489,7 @@ ex_it(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
airport(int c __attribute__((__unused__)))
{
@@ -487,6 +497,7 @@ airport(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
climb(int c __attribute__((__unused__)))
{
@@ -494,6 +505,7 @@ climb(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
descend(int c __attribute__((__unused__)))
{
@@ -525,7 +537,6 @@ setrelalt(int c)
break;
default:
return ("Unknown case in setrelalt! Get help!");
- break;
}
if (p.new_altitude < 0)
return ("Altitude would be too low");
@@ -560,7 +571,6 @@ benum(int c)
break;
default:
return ("Unknown case in benum! Get help!");
- break;
}
return (NULL);
}
@@ -591,11 +601,11 @@ rel_dir(int c)
break;
default:
return ("Bizarre direction in rel_dir! Get help!");
- break;
}
return (NULL);
}
+/* ARGSUSED */
const char *
mark(int c __attribute__((__unused__)))
{
@@ -607,6 +617,7 @@ mark(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
unmark(int c __attribute__((__unused__)))
{
@@ -618,6 +629,7 @@ unmark(int c __attribute__((__unused__)))
return (NULL);
}
+/* ARGSUSED */
const char *
ignore(int c __attribute__((__unused__)))
{
@@ -645,7 +657,7 @@ dir_no(int ch)
case 'a': dirno = 6; break;
case 'q': dirno = 7; break;
default:
- fprintf(stderr, "bad character in dir_no\n");
+ (void)fprintf(stderr, "bad character in dir_no\n");
break;
}
return (dirno);
diff --git a/atc/log.c b/atc/log.c
index 2860e040..0db1b4d9 100644
--- a/atc/log.c
+++ b/atc/log.c
@@ -1,4 +1,4 @@
-/* $NetBSD: log.c,v 1.15 2005/08/10 16:10:51 rpaulo Exp $ */
+/* $NetBSD: log.c,v 1.16 2005/08/10 17:53:28 rpaulo 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.15 2005/08/10 16:10:51 rpaulo Exp $");
+__RCSID("$NetBSD: log.c,v 1.16 2005/08/10 17:53:28 rpaulo Exp $");
#endif
#endif /* not lint */
@@ -106,7 +106,7 @@ open_score_file(void)
old_mask = umask(0);
score_fd = open(_PATH_SCORE, O_CREAT|O_RDWR, 0664);
- umask(old_mask);
+ (void)umask(old_mask);
if (score_fd < 0) {
warn("open %s", _PATH_SCORE);
return;
@@ -159,34 +159,35 @@ log_score(int list_em)
}
for (;;) {
good = fscanf(score_fp, SCORE_SCANF_FMT,
- score[num_scores].name,
- score[num_scores].host,
- score[num_scores].game,
- &score[num_scores].planes,
- &score[num_scores].time,
- &score[num_scores].real_time);
+ score[num_scores].name,
+ score[num_scores].host,
+ score[num_scores].game,
+ &score[num_scores].planes,
+ &score[num_scores].time,
+ &score[num_scores].real_time);
if (good != 6 || ++num_scores >= NUM_SCORES)
break;
}
if (!test_mode && !list_em) {
if ((pw = (struct passwd *) getpwuid(getuid())) == NULL) {
- fprintf(stderr,
+ (void)fprintf(stderr,
"getpwuid failed for uid %d. Who are you?\n",
(int)getuid());
return (-1);
}
- strcpy(thisscore.name, pw->pw_name);
- uname(&lname);
- strlcpy(thisscore.host, lname.nodename, sizeof(thisscore.host));
+ (void)strcpy(thisscore.name, pw->pw_name);
+ (void)uname(&lname);
+ (void)strlcpy(thisscore.host, lname.nodename,
+ sizeof(thisscore.host));
cp = strrchr(filename, '/');
if (cp == NULL) {
- fprintf(stderr, "log: where's the '/' in %s?\n",
+ (void)fprintf(stderr, "log: where's the '/' in %s?\n",
filename);
return (-1);
}
cp++;
- strcpy(thisscore.game, cp);
+ (void)strcpy(thisscore.game, cp);
thisscore.time = clck;
thisscore.planes = safe_planes;
@@ -200,7 +201,7 @@ log_score(int list_em)
score[i].time = thisscore.time;
score[i].planes = thisscore.planes;
score[i].real_time =
- thisscore.real_time;
+ thisscore.real_time;
changed++;
}
found++;
@@ -212,36 +213,36 @@ log_score(int list_em)
if (thisscore.time > score[i].time) {
if (num_scores < NUM_SCORES)
num_scores++;
- memcpy(&score[num_scores - 1],
- &score[i],
- sizeof (score[i]));
- memcpy(&score[i], &thisscore,
- sizeof (score[i]));
+ (void)memcpy(&score[num_scores - 1],
+ &score[i], sizeof (score[i]));
+ (void)memcpy(&score[i], &thisscore,
+ sizeof (score[i]));
changed++;
break;
}
}
}
if (!found && !changed && num_scores < NUM_SCORES) {
- memcpy(&score[num_scores], &thisscore,
- sizeof (score[num_scores]));
+ (void)memcpy(&score[num_scores], &thisscore,
+ sizeof (score[num_scores]));
num_scores++;
changed++;
}
if (changed) {
if (found)
- puts("You beat your previous score!");
+ (void)puts("You beat your previous score!");
else
- puts("You made the top players list!");
- qsort(score, num_scores, sizeof (*score), compar);
+ (void)puts("You made the top players list!");
+ qsort(score, (size_t)num_scores, sizeof (*score),
+ compar);
rewind(score_fp);
for (i = 0; i < num_scores; i++)
- fprintf(score_fp, "%s %s %s %d %d %d\n",
- score[i].name, score[i].host,
- score[i].game, score[i].planes,
- score[i].time, score[i].real_time);
- fflush(score_fp);
+ (void)fprintf(score_fp, "%s %s %s %d %d %d\n",
+ score[i].name, score[i].host,
+ score[i].game, score[i].planes,
+ score[i].time, score[i].real_time);
+ (void)fflush(score_fp);
if (ferror(score_fp))
warn("error writing %s", _PATH_SCORE);
/* It is just possible that updating an entry could
@@ -249,41 +250,44 @@ log_score(int list_em)
* truncate it. The seeks are required for stream/fd
* synchronisation by POSIX.1. */
offset = ftell(score_fp);
- lseek(fileno(score_fp), 0, SEEK_SET);
- ftruncate(fileno(score_fp), offset);
+ (void)lseek(fileno(score_fp), (off_t)0, SEEK_SET);
+ (void)ftruncate(fileno(score_fp), (off_t)offset);
rewind(score_fp);
} else {
if (found)
- puts("You didn't beat your previous score.");
+ (void)puts(
+ "You didn't beat your previous score.");
else
- puts("You didn't make the top players list.");
+ (void)puts(
+ "You didn't make the top players list.");
}
- putchar('\n');
+ (void)putchar('\n');
}
#ifdef BSD
- flock(fileno(score_fp), LOCK_UN);
+ (void)flock(fileno(score_fp), LOCK_UN);
#endif
#ifdef SYSV
/* lock will evaporate upon close */
#endif
- fclose(score_fp);
- printf("%2s: %-8s %-8s %-18s %4s %9s %4s\n", "#", "name", "host",
- "game", "time", "real time", "planes safe");
+ (void)fclose(score_fp);
+ (void)printf("%2s: %-8s %-8s %-18s %4s %9s %4s\n", "#", "name",
+ "host", "game", "time", "real time", "planes safe");
(void)printf("-------------------------------------------------------");
(void)printf("------------------------\n");
for (i = 0; i < num_scores; i++) {
cp = strchr(score[i].host, '.');
if (cp != NULL)
*cp = '\0';
- printf("%2d: %-8s %-8s %-18s %4d %9s %4d\n", i + 1,
- score[i].name, score[i].host, score[i].game,
- score[i].time, timestr(score[i].real_time),
- score[i].planes);
+ (void)printf("%2d: %-8s %-8s %-18s %4d %9s %4d\n", i + 1,
+ score[i].name, score[i].host, score[i].game,
+ score[i].time, timestr(score[i].real_time),
+ score[i].planes);
}
- putchar('\n');
+ (void)putchar('\n');
return (0);
}
+/* ARGSUSED */
void
log_score_quit(int dummy __attribute__((__unused__)))
{
diff --git a/atc/main.c b/atc/main.c
index c69064b6..898a7fa2 100644
--- a/atc/main.c
+++ b/atc/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.14 2005/07/01 00:48:34 jmc Exp $ */
+/* $NetBSD: main.c,v 1.15 2005/08/10 17:53:28 rpaulo 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.14 2005/07/01 00:48:34 jmc Exp $");
+__RCSID("$NetBSD: main.c,v 1.15 2005/08/10 17:53:28 rpaulo Exp $");
#endif
#endif /* not lint */
@@ -75,7 +75,7 @@ main(int argc, char *argv[])
/* Open the score file then revoke setgid privileges */
open_score_file();
- setgid(getgid());
+ (void)setgid(getgid());
start_time = seed = time(NULL);
@@ -107,22 +107,22 @@ main(int argc, char *argv[])
}
if (optind < argc)
f_usage++;
- srandom(seed);
+ srandom((unsigned long)seed);
if (f_usage)
- fprintf(stderr,
+ (void)fprintf(stderr,
"Usage: %s -[u?lstp] [-[gf] game_name] [-r random seed]\n",
- argv[0]);
+ argv[0]);
if (f_showscore)
- log_score(1);
+ (void)log_score(1);
if (f_list)
- list_games();
+ (void)list_games();
if (f_printpath) {
char buf[100];
- strcpy(buf, _PATH_GAMES);
+ (void)strcpy(buf, _PATH_GAMES);
buf[strlen(buf) - 1] = '\0';
- puts(buf);
+ (void)puts(buf);
}
if (f_usage || f_showscore || f_list || f_printpath)
@@ -139,38 +139,38 @@ main(int argc, char *argv[])
init_gr();
setup_screen(sp);
- addplane();
+ (void)addplane();
- signal(SIGINT, quit);
- signal(SIGQUIT, quit);
+ (void)signal(SIGINT, quit);
+ (void)signal(SIGQUIT, quit);
#ifdef BSD
- signal(SIGTSTP, SIG_IGN);
- signal(SIGSTOP, SIG_IGN);
+ (void)signal(SIGTSTP, SIG_IGN);
+ (void)signal(SIGSTOP, SIG_IGN);
#endif
- signal(SIGHUP, log_score_quit);
- signal(SIGTERM, log_score_quit);
+ (void)signal(SIGHUP, log_score_quit);
+ (void)signal(SIGTERM, log_score_quit);
- tcgetattr(fileno(stdin), &tty_start);
+ (void)tcgetattr(fileno(stdin), &tty_start);
tty_new = tty_start;
tty_new.c_lflag &= ~(ICANON|ECHO);
tty_new.c_iflag |= ICRNL;
tty_new.c_cc[VMIN] = 1;
tty_new.c_cc[VTIME] = 0;
- tcsetattr(fileno(stdin), TCSADRAIN, &tty_new);
+ (void)tcsetattr(fileno(stdin), TCSADRAIN, &tty_new);
sa.sa_handler = update;
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGALRM);
- sigaddset(&sa.sa_mask, SIGINT);
+ (void)sigemptyset(&sa.sa_mask);
+ (void)sigaddset(&sa.sa_mask, SIGALRM);
+ (void)sigaddset(&sa.sa_mask, SIGINT);
sa.sa_flags = 0;
- sigaction(SIGALRM, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGALRM, &sa, (struct sigaction *)0);
#ifdef BSD
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = 1;
itv.it_interval.tv_sec = sp->update_secs;
itv.it_interval.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
+ (void)setitimer(ITIMER_REAL, &itv, NULL);
#endif
#ifdef SYSV
alarm(sp->update_secs);
@@ -183,7 +183,7 @@ main(int argc, char *argv[])
#ifdef BSD
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
+ (void)setitimer(ITIMER_REAL, &itv, NULL);
#endif
#ifdef SYSV
alarm(0);
@@ -196,7 +196,7 @@ main(int argc, char *argv[])
itv.it_value.tv_usec = 0;
itv.it_interval.tv_sec = sp->update_secs;
itv.it_interval.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
+ (void)setitimer(ITIMER_REAL, &itv, NULL);
#endif
#ifdef SYSV
alarm(sp->update_secs);
@@ -217,7 +217,7 @@ read_file(const char *s)
return (-1);
}
retval = yyparse();
- fclose(yyin);
+ (void)fclose(yyin);
if (retval != 0)
return (-1);
@@ -232,21 +232,21 @@ default_game(void)
static char file[256];
char line[256], games[256];
- strcpy(games, _PATH_GAMES);
- strcat(games, GAMES);
+ (void)strcpy(games, _PATH_GAMES);
+ (void)strcat(games, GAMES);
if ((fp = fopen(games, "r")) == NULL) {
warn("fopen %s", games);
return (NULL);
}
if (fgets(line, sizeof(line), fp) == NULL) {
- fprintf(stderr, "%s: no default game available\n", games);
+ (void)fprintf(stderr, "%s: no default game available\n", games);
return (NULL);
}
- fclose(fp);
+ (void)fclose(fp);
line[strlen(line) - 1] = '\0';
- strcpy(file, _PATH_GAMES);
- strcat(file, line);
+ (void)strcpy(file, _PATH_GAMES);
+ (void)strcat(file, line);
return (file);
}
@@ -258,8 +258,8 @@ okay_game(const char *s)
const char *ret = NULL;
char line[256], games[256];
- strcpy(games, _PATH_GAMES);
- strcat(games, GAMES);
+ (void)strcpy(games, _PATH_GAMES);
+ (void)strcat(games, GAMES);
if ((fp = fopen(games, "r")) == NULL) {
warn("fopen %s", games);
@@ -268,19 +268,19 @@ okay_game(const char *s)
while (fgets(line, sizeof(line), fp) != NULL) {
line[strlen(line) - 1] = '\0';
if (strcmp(s, line) == 0) {
- strcpy(file, _PATH_GAMES);
- strcat(file, line);
+ (void)strcpy(file, _PATH_GAMES);
+ (void)strcat(file, line);
ret = file;
break;
}
}
- fclose(fp);
+ (void)fclose(fp);
if (ret == NULL) {
test_mode = 1;
ret = s;
- fprintf(stderr, "%s: %s: game not found\n", games, s);
- fprintf(stderr, "Your score will not be logged.\n");
- sleep(2); /* give the guy time to read it */
+ (void)fprintf(stderr, "%s: %s: game not found\n", games, s);
+ (void)fprintf(stderr, "Your score will not be logged.\n");
+ (void)sleep(2); /* give the guy time to read it */
}
return (ret);
}
@@ -292,21 +292,21 @@ list_games(void)
char line[256], games[256];
int num_games = 0;
- strcpy(games, _PATH_GAMES);
- strcat(games, GAMES);
+ (void)strcpy(games, _PATH_GAMES);
+ (void)strcat(games, GAMES);
if ((fp = fopen(games, "r")) == NULL) {
warn("fopen %s", games);
return (-1);
}
- puts("available games:");
+ (void)puts("available games:");
while (fgets(line, sizeof(line), fp) != NULL) {
- printf(" %s", line);
+ (void)printf(" %s", line);
num_games++;
}
- fclose(fp);
+ (void)fclose(fp);
if (num_games == 0) {
- fprintf(stderr, "%s: no games available\n", games);
+ (void)fprintf(stderr, "%s: no games available\n", games);
return (-1);
}
return (0);
diff --git a/atc/update.c b/atc/update.c
index 3b8aa728..963c57f3 100644
--- a/atc/update.c
+++ b/atc/update.c
@@ -1,4 +1,4 @@
-/* $NetBSD: update.c,v 1.13 2005/07/01 00:48:34 jmc Exp $ */
+/* $NetBSD: update.c,v 1.14 2005/08/10 17:53:28 rpaulo Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,12 +46,13 @@
#if 0
static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: update.c,v 1.13 2005/07/01 00:48:34 jmc Exp $");
+__RCSID("$NetBSD: update.c,v 1.14 2005/08/10 17:53:28 rpaulo Exp $");
#endif
#endif /* not lint */
#include "include.h"
+/* ARGSUSED */
void
update(int dummy __attribute__((__unused__)))
{
@@ -210,7 +211,7 @@ update(int dummy __attribute__((__unused__)))
* we don't update props on odd updates.
*/
if ((rand() % sp->newplane_time) == 0)
- addplane();
+ (void)addplane();
#ifdef SYSV
alarm(sp->update_secs);
@@ -232,7 +233,7 @@ command(const PLANE *pp)
if (pp->altitude == 0)
(void)sprintf(bp, "Holding @ A%d", pp->orig_no);
else if (pp->new_dir >= MAXDIR || pp->new_dir < 0)
- strcpy(bp, "Circle");
+ (void)strcpy(bp, "Circle");
else if (pp->new_dir != pp->dir)
(void)sprintf(bp, "%d", dir_deg(pp->new_dir));
@@ -243,7 +244,7 @@ command(const PLANE *pp)
bp = strchr(buf, '\0');
if (*comm_start == '\0' &&
(pp->status == S_UNMARKED || pp->status == S_IGNORED))
- strcpy(bp, "---------");
+ (void)strcpy(bp, "---------");
return (buf);
}
@@ -302,7 +303,7 @@ addplane(void)
PLANE p, *pp, *p1;
int i, num_starts, isclose, rnd, rnd2, pnum;
- memset(&p, 0, sizeof (p));
+ (void)memset(&p, 0, sizeof (p));
p.status = S_MARKED;
p.plane_type = random() % 2;
@@ -359,7 +360,7 @@ addplane(void)
pp = newplane();
if (pp == NULL)
loser(NULL, "Out of memory!");
- memcpy(pp, &p, sizeof (p));
+ (void)memcpy(pp, &p, sizeof (p));
if (pp->orig_type == T_AIRPORT)
append(&ground, pp);