CVS commit: src/games/atc
Module Name:src Committed By: pgoyette Date: Tue Mar 19 00:11:34 UTC 2019 Modified Files: src/games/atc: log.c Log Message: Report the users score _after_ the game has ended and the screen has been restored to pre-game state. Otherwise, the user gets a message that their score did (or more likely, did not) improve over their previous score, yet the user has no indication of what the current score actually was! To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/games/atc/log.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/log.c diff -u src/games/atc/log.c:1.23 src/games/atc/log.c:1.24 --- src/games/atc/log.c:1.23 Tue Jan 10 20:40:53 2017 +++ src/games/atc/log.c Tue Mar 19 00:11:34 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: log.c,v 1.23 2017/01/10 20:40:53 christos Exp $ */ +/* $NetBSD: log.c,v 1.24 2019/03/19 00:11:34 pgoyette 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.23 2017/01/10 20:40:53 christos Exp $"); +__RCSID("$NetBSD: log.c,v 1.24 2019/03/19 00:11:34 pgoyette Exp $"); #endif #endif /* not lint */ @@ -161,6 +161,12 @@ log_score(int list_em) struct utsname lname; long offset; + if (safe_planes == 1) + printf("You directed 1 plane safely to its destination.\n\n"); + else + printf("You directed %d planes safely to their destinations.\n\n", + safe_planes); + if (score_fp == NULL) { warnx("no score file available"); return (-1);
CVS commit: src/games/atc
Module Name:src Committed By: christos Date: Tue Jan 10 20:40:53 UTC 2017 Modified Files: src/games/atc: log.c Log Message: ned stat.h To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/games/atc/log.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/log.c diff -u src/games/atc/log.c:1.22 src/games/atc/log.c:1.23 --- src/games/atc/log.c:1.22 Fri Jun 19 02:02:31 2015 +++ src/games/atc/log.c Tue Jan 10 15:40:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: log.c,v 1.22 2015/06/19 06:02:31 dholland Exp $ */ +/* $NetBSD: log.c,v 1.23 2017/01/10 20:40:53 christos Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,12 +46,13 @@ #if 0 static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: log.c,v 1.22 2015/06/19 06:02:31 dholland Exp $"); +__RCSID("$NetBSD: log.c,v 1.23 2017/01/10 20:40:53 christos Exp $"); #endif #endif /* not lint */ #include #include +#include /* for umask(2) */ #include #include #include
CVS commit: src/games/atc
Module Name:src Committed By: wiz Date: Sun Jul 26 22:22:24 UTC 2015 Modified Files: src/games/atc: atc.6 Log Message: Use An in AUTHORS section. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/games/atc/atc.6 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/atc.6 diff -u src/games/atc/atc.6:1.23 src/games/atc/atc.6:1.24 --- src/games/atc/atc.6:1.23 Thu Jul 23 01:19:20 2015 +++ src/games/atc/atc.6 Sun Jul 26 22:22:24 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: atc.6,v 1.23 2015/07/23 01:19:20 pgoyette Exp $ +.\" $NetBSD: atc.6,v 1.24 2015/07/26 22:22:24 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -493,7 +493,10 @@ which holds the list of playable games, The scores are kept in .Pa /var/games/atc_score . .Sh AUTHORS -Ed James, UC Berkeley: edja...@ucbvax.berkeley.edu, ucbvax!edjames +.An Ed James , +UC Berkeley: +.Aq Mt edja...@ucbvax.berkeley.edu , +ucbvax!edjames .Pp This game is based on someone's description of the overall flavor of a game written for some unknown PC many years ago, maybe.
CVS commit: src/games/atc
Module Name:src Committed By: pgoyette Date: Thu Jul 23 01:19:20 UTC 2015 Modified Files: src/games/atc: atc.6 Log Message: Sync descriptive text with actual game definition. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/games/atc/atc.6 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/atc.6 diff -u src/games/atc/atc.6:1.22 src/games/atc/atc.6:1.23 --- src/games/atc/atc.6:1.22 Thu Sep 15 02:09:41 2005 +++ src/games/atc/atc.6 Thu Jul 23 01:19:20 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: atc.6,v 1.22 2005/09/15 02:09:41 wiz Exp $ +.\" $NetBSD: atc.6,v 1.23 2015/07/23 01:19:20 pgoyette Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -456,7 +456,7 @@ diagonal. # This is the default game. update = 5; -newplane = 5; +newplane = 10; width = 30; height = 21;
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Thu Jun 25 05:33:02 UTC 2015 Modified Files: src/games/atc: extern.h graphics.c main.c update.c Log Message: Move game logic out of the file with the curses code. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/games/atc/extern.h cvs rdiff -u -r1.19 -r1.20 src/games/atc/graphics.c cvs rdiff -u -r1.23 -r1.24 src/games/atc/main.c cvs rdiff -u -r1.26 -r1.27 src/games/atc/update.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/extern.h diff -u src/games/atc/extern.h:1.18 src/games/atc/extern.h:1.19 --- src/games/atc/extern.h:1.18 Fri Jun 19 06:02:31 2015 +++ src/games/atc/extern.h Thu Jun 25 05:33:02 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.18 2015/06/19 06:02:31 dholland Exp $ */ +/* $NetBSD: extern.h,v 1.19 2015/06/25 05:33:02 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -64,6 +64,13 @@ extern struct termios tty_start, tty_new extern DISPLACEMENT displacement[MAXDIR]; +/* in graphics.c */ +void shutdown_gr(void); +void ioaskquit(void); +void ionoquit(void); +void losermsg(const PLANE *p, const char *msg); + +/* misc */ void addplane(void); void append(LIST *, PLANE *); void check_adir(int, int, int); @@ -88,7 +95,6 @@ char name(const PLANE *); int number(int); void open_score_file(void); void planewin(void); -void quit(int); void redraw(void); void setup_screen(const C_SCREEN *); void update(int); Index: src/games/atc/graphics.c diff -u src/games/atc/graphics.c:1.19 src/games/atc/graphics.c:1.20 --- src/games/atc/graphics.c:1.19 Fri Jun 19 06:02:31 2015 +++ src/games/atc/graphics.c Thu Jun 25 05:33:02 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: graphics.c,v 1.19 2015/06/19 06:02:31 dholland Exp $ */ +/* $NetBSD: graphics.c,v 1.20 2015/06/25 05:33:02 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.19 2015/06/19 06:02:31 dholland Exp $"); +__RCSID("$NetBSD: graphics.c,v 1.20 2015/06/25 05:33:02 dholland Exp $"); #endif #endif /* not lint */ @@ -136,6 +136,15 @@ init_gr(void) } void +shutdown_gr(void) +{ + (void)clear(); /* move to top of screen */ + (void)refresh(); + (void)fflush(stdout); + (void)endwin(); +} + +void setup_screen(const C_SCREEN *scp) { int i, j; @@ -293,43 +302,25 @@ ioerror(int pos, int len, const char *st (void)fflush(stdout); } -/* ARGSUSED */ +static int ioquit_x, ioquit_y; + void -quit(int dummy __unused) +ioaskquit(void) { - int c, y, x; -#ifdef BSD - struct itimerval itv; -#endif - - getyx(input, y, x); + getyx(input, ioquit_y, ioquit_x); (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') { - /* disable timer */ -#ifdef BSD - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 0; - (void)setitimer(ITIMER_REAL, &itv, NULL); -#endif -#ifdef SYSV - alarm(0); -#endif - (void)fflush(stdout); - (void)clear(); - (void)refresh(); - (void)endwin(); - (void)log_score(0); - exit(0); - } +void +ionoquit(void) +{ (void)wmove(input, 2, 0); (void)wclrtobot(input); - (void)wmove(input, y, x); + (void)wmove(input, ioquit_y, ioquit_x); (void)wrefresh(input); (void)fflush(stdout); } @@ -378,42 +369,20 @@ planewin(void) } void -loser(const PLANE *p, const char *s) +losermsg(const PLANE *p, const char *msg) { - int c; -#ifdef BSD - struct itimerval itv; -#endif - - /* disable timer */ -#ifdef BSD - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 0; - (void)setitimer(ITIMER_REAL, &itv, NULL); -#endif -#ifdef SYSV - alarm(0); -#endif - (void)wmove(input, 0, 0); (void)wclrtobot(input); /* p may be NULL if we ran out of memory */ if (p == NULL) (void)wprintw(input, "%s\n\nHit space for top players list...", - s); + msg); else { - (void)wprintw(input, "Plane '%c' %s\n\n", name(p), s); + (void)wprintw(input, "Plane '%c' %s\n\n", name(p), msg); (void)wprintw(input, "Hit space for top players list..."); } (void)wrefresh(input); (void)fflush(stdout); - while ((c = getchar()) != EOF && c != ' ') - ; - (void)clear(); /* move to top of screen */ - (void)refresh(); - (void)endwin(); - (void)log_score(0); - exit(0); } void Index: src/games/atc/main.c diff -u src/games/atc/main.c:1.23 src/games/atc/main.c:1.24 --- src/games/atc/main.c:1.23 Fri Jun 19 06:02:31 2015 +++ src/games/atc/main.c Thu Jun 25 05:33:02 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.23 2015/06/19 06:02:31 dholland Exp $ */ +/* $NetBSD: main.c,v 1.24 2015/06/25 05:33:02 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCS
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Fri Jun 19 06:02:31 UTC 2015 Modified Files: src/games/atc: extern.c extern.h grammar.y graphics.c input.c lex.l list.c log.c main.c update.c Removed Files: src/games/atc: include.h Log Message: Abolish the foul practice of including every header in existence via a single central "include.h". Use only headers that are actually needed. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/games/atc/extern.c src/games/atc/grammar.y cvs rdiff -u -r1.17 -r1.18 src/games/atc/extern.h cvs rdiff -u -r1.18 -r1.19 src/games/atc/graphics.c cvs rdiff -u -r1.9 -r0 src/games/atc/include.h cvs rdiff -u -r1.28 -r1.29 src/games/atc/input.c cvs rdiff -u -r1.8 -r1.9 src/games/atc/lex.l src/games/atc/list.c cvs rdiff -u -r1.21 -r1.22 src/games/atc/log.c cvs rdiff -u -r1.22 -r1.23 src/games/atc/main.c cvs rdiff -u -r1.25 -r1.26 src/games/atc/update.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/extern.c diff -u src/games/atc/extern.c:1.11 src/games/atc/extern.c:1.12 --- src/games/atc/extern.c:1.11 Wed Aug 12 04:48:03 2009 +++ src/games/atc/extern.c Fri Jun 19 06:02:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.c,v 1.11 2009/08/12 04:48:03 dholland Exp $ */ +/* $NetBSD: extern.c,v 1.12 2015/06/19 06:02:31 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,11 +46,16 @@ #if 0 static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: extern.c,v 1.11 2009/08/12 04:48:03 dholland Exp $"); +__RCSID("$NetBSD: extern.c,v 1.12 2015/06/19 06:02:31 dholland Exp $"); #endif #endif /* not lint */ -#include "include.h" +#include + +#include "def.h" +#include "struct.h" +#include "extern.h" +#include "tunable.h" char GAMES[] = "Game_List"; Index: src/games/atc/grammar.y diff -u src/games/atc/grammar.y:1.11 src/games/atc/grammar.y:1.12 --- src/games/atc/grammar.y:1.11 Sat Mar 22 22:09:14 2014 +++ src/games/atc/grammar.y Fri Jun 19 06:02:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: grammar.y,v 1.11 2014/03/22 22:09:14 dholland Exp $ */ +/* $NetBSD: grammar.y,v 1.12 2015/06/19 06:02:31 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -57,17 +57,22 @@ } %{ -#include "include.h" - #include #ifndef lint #if 0 static char sccsid[] = "@(#)grammar.y 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: grammar.y,v 1.11 2014/03/22 22:09:14 dholland Exp $"); +__RCSID("$NetBSD: grammar.y,v 1.12 2015/06/19 06:02:31 dholland Exp $"); #endif #endif /* not lint */ +#include + +#include "def.h" +#include "struct.h" +#include "extern.h" +#include "tunable.h" + int line = 1; static int errors = 0; Index: src/games/atc/extern.h diff -u src/games/atc/extern.h:1.17 src/games/atc/extern.h:1.18 --- src/games/atc/extern.h:1.17 Sat Mar 22 22:58:56 2014 +++ src/games/atc/extern.h Fri Jun 19 06:02:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.17 2014/03/22 22:58:56 dholland Exp $ */ +/* $NetBSD: extern.h,v 1.18 2015/06/19 06:02:31 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -43,6 +43,9 @@ * For more info on this and all of my stuff, mail edja...@berkeley.edu. */ +#include /* for time_t */ + + extern char GAMES[]; extern const char *filename; Index: src/games/atc/graphics.c diff -u src/games/atc/graphics.c:1.18 src/games/atc/graphics.c:1.19 --- src/games/atc/graphics.c:1.18 Sat Mar 22 22:33:35 2014 +++ src/games/atc/graphics.c Fri Jun 19 06:02:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: graphics.c,v 1.18 2014/03/22 22:33:35 dholland Exp $ */ +/* $NetBSD: graphics.c,v 1.19 2015/06/19 06:02:31 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,11 +46,20 @@ #if 0 static char sccsid[] = "@(#)graphics.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: graphics.c,v 1.18 2014/03/22 22:33:35 dholland Exp $"); +__RCSID("$NetBSD: graphics.c,v 1.19 2015/06/19 06:02:31 dholland Exp $"); #endif #endif /* not lint */ -#include "include.h" +#include +#include +#include +#include +#include + +#include "def.h" +#include "struct.h" +#include "extern.h" +#include "tunable.h" #define C_TOPBOTTOM '-' #define C_LEFTRIGHT '|' Index: src/games/atc/input.c diff -u src/games/atc/input.c:1.28 src/games/atc/input.c:1.29 --- src/games/atc/input.c:1.28 Sat Mar 22 22:58:56 2014 +++ src/games/atc/input.c Fri Jun 19 06:02:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: input.c,v 1.28 2014/03/22 22:58:56 dholland Exp $ */ +/* $NetBSD: input.c,v 1.29 2015/06/19 06:02:31 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,12 +46,26 @@ #if 0 static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: input.c,v 1.28 2014/03/22 22:58:56 dholland Exp $"); +__RCSID("$NetBSD: input.c,v 1.29 2015/06/19 06:02:31 dholland Exp $"); #endif #endif /* not lint */ -#include "include.h" +#include +#include +#include +#include +#include +#include +#include +
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Sat Mar 22 22:58:56 UTC 2014 Modified Files: src/games/atc: def.h extern.h input.c main.c struct.h update.c Log Message: Make the list of place types an enumeration. Use unsigned values for place numbers. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/games/atc/def.h cvs rdiff -u -r1.16 -r1.17 src/games/atc/extern.h cvs rdiff -u -r1.27 -r1.28 src/games/atc/input.c cvs rdiff -u -r1.21 -r1.22 src/games/atc/main.c cvs rdiff -u -r1.9 -r1.10 src/games/atc/struct.h cvs rdiff -u -r1.24 -r1.25 src/games/atc/update.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/def.h diff -u src/games/atc/def.h:1.6 src/games/atc/def.h:1.7 --- src/games/atc/def.h:1.6 Thu Aug 7 09:36:53 2003 +++ src/games/atc/def.h Sat Mar 22 22:58:56 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: def.h,v 1.6 2003/08/07 09:36:53 agc Exp $ */ +/* $NetBSD: def.h,v 1.7 2014/03/22 22:58:56 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -65,11 +65,6 @@ #define D_UP 3 #define D_DOWN 4 -#define T_NODEST 0 -#define T_BEACON 1 -#define T_EXIT 2 -#define T_AIRPORT 3 - #undef S_NONE #undef S_GONE #undef S_MARKED Index: src/games/atc/extern.h diff -u src/games/atc/extern.h:1.16 src/games/atc/extern.h:1.17 --- src/games/atc/extern.h:1.16 Wed Aug 12 04:48:03 2009 +++ src/games/atc/extern.h Sat Mar 22 22:58:56 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.16 2009/08/12 04:48:03 dholland Exp $ */ +/* $NetBSD: extern.h,v 1.17 2014/03/22 22:58:56 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -61,7 +61,7 @@ extern struct termios tty_start, tty_new extern DISPLACEMENT displacement[MAXDIR]; -int addplane(void); +void addplane(void); void append(LIST *, PLANE *); void check_adir(int, int, int); void delete(LIST *, PLANE *); Index: src/games/atc/input.c diff -u src/games/atc/input.c:1.27 src/games/atc/input.c:1.28 --- src/games/atc/input.c:1.27 Sat Mar 22 22:47:07 2014 +++ src/games/atc/input.c Sat Mar 22 22:58:56 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: input.c,v 1.27 2014/03/22 22:47:07 dholland Exp $ */ +/* $NetBSD: input.c,v 1.28 2014/03/22 22:58:56 dholland 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.27 2014/03/22 22:47:07 dholland Exp $"); +__RCSID("$NetBSD: input.c,v 1.28 2014/03/22 22:58:56 dholland Exp $"); #endif #endif /* not lint */ @@ -199,7 +199,8 @@ static PLANE p; static STACK stack[MAXDEPTH]; static int level; static int tval; -static int dest_type, dir; +static int dir; +static enum places dest_type; static unsigned dest_no; static int Index: src/games/atc/main.c diff -u src/games/atc/main.c:1.21 src/games/atc/main.c:1.22 --- src/games/atc/main.c:1.21 Fri Oct 12 10:44:20 2012 +++ src/games/atc/main.c Sat Mar 22 22:58:56 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.21 2012/10/12 10:44:20 dholland Exp $ */ +/* $NetBSD: main.c,v 1.22 2014/03/22 22:58:56 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.21 2012/10/12 10:44:20 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.22 2014/03/22 22:58:56 dholland Exp $"); #endif #endif /* not lint */ @@ -144,7 +144,7 @@ main(int argc, char *argv[]) init_gr(); setup_screen(sp); - (void)addplane(); + addplane(); (void)signal(SIGINT, quit); (void)signal(SIGQUIT, quit); Index: src/games/atc/struct.h diff -u src/games/atc/struct.h:1.9 src/games/atc/struct.h:1.10 --- src/games/atc/struct.h:1.9 Sat Mar 22 22:45:05 2014 +++ src/games/atc/struct.h Sat Mar 22 22:58:56 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: struct.h,v 1.9 2014/03/22 22:45:05 dholland Exp $ */ +/* $NetBSD: struct.h,v 1.10 2014/03/22 22:58:56 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -72,15 +72,22 @@ typedef struct { AIRPORT *airport; } C_SCREEN; +enum places { + T_NODEST = 0, + T_BEACON = 1, + T_EXIT = 2, + T_AIRPORT = 3 +}; + typedef struct plane { struct plane *next, *prev; int status; int plane_no; int plane_type; - int orig_no; - int orig_type; - int dest_no; - int dest_type; + unsigned orig_no; + enum places orig_type; + unsigned dest_no; + enum places dest_type; int altitude; int new_altitude; int dir; Index: src/games/atc/update.c diff -u src/games/atc/update.c:1.24 src/games/atc/update.c:1.25 --- src/games/atc/update.c:1.24 Sat Mar 22 22:45:05 2014 +++ src/games/atc/update.c Sat Mar 22 22:58:56 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: update.c,v 1.24 2014/03/22 22:45:05 dholland Exp $ */ +/* $NetBSD: update.c,v 1.25 2014/03/22 22:58:56 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,7 +46,7 @@ #if 0 static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93"; #else -__
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Sat Mar 22 22:47:07 UTC 2014 Modified Files: src/games/atc: input.c Log Message: use a more suitable type To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/games/atc/input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/input.c diff -u src/games/atc/input.c:1.26 src/games/atc/input.c:1.27 --- src/games/atc/input.c:1.26 Sat Mar 22 22:45:05 2014 +++ src/games/atc/input.c Sat Mar 22 22:47:07 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: input.c,v 1.26 2014/03/22 22:45:05 dholland Exp $ */ +/* $NetBSD: input.c,v 1.27 2014/03/22 22:47:07 dholland 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.26 2014/03/22 22:45:05 dholland Exp $"); +__RCSID("$NetBSD: input.c,v 1.27 2014/03/22 22:47:07 dholland Exp $"); #endif #endif /* not lint */ @@ -199,7 +199,8 @@ static PLANE p; static STACK stack[MAXDEPTH]; static int level; static int tval; -static int dest_type, dest_no, dir; +static int dest_type, dir; +static unsigned dest_no; static int pop(void)
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Sat Mar 22 22:45:05 UTC 2014 Modified Files: src/games/atc: input.c struct.h update.c Log Message: use more suitable types To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/games/atc/input.c cvs rdiff -u -r1.8 -r1.9 src/games/atc/struct.h cvs rdiff -u -r1.23 -r1.24 src/games/atc/update.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/input.c diff -u src/games/atc/input.c:1.25 src/games/atc/input.c:1.26 --- src/games/atc/input.c:1.25 Sat Mar 22 22:24:21 2014 +++ src/games/atc/input.c Sat Mar 22 22:45:05 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: input.c,v 1.25 2014/03/22 22:24:21 dholland Exp $ */ +/* $NetBSD: input.c,v 1.26 2014/03/22 22:45:05 dholland 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.25 2014/03/22 22:24:21 dholland Exp $"); +__RCSID("$NetBSD: input.c,v 1.26 2014/03/22 22:45:05 dholland Exp $"); #endif #endif /* not lint */ @@ -393,7 +393,7 @@ setplane(int c) if (pp == NULL) return ("Unknown Plane"); (void)memcpy(&p, pp, sizeof (p)); - p.delayd = 0; + p.delayd = false; return (NULL); } @@ -474,7 +474,7 @@ delayb(int ch) ydiff = SGN(ydiff); if (xdiff != displacement[p.dir].dx || ydiff != displacement[p.dir].dy) return ("Beacon is not in flight path"); - p.delayd = 1; + p.delayd = true; p.delayd_no = bn; if (dest_type != T_NODEST) { Index: src/games/atc/struct.h diff -u src/games/atc/struct.h:1.8 src/games/atc/struct.h:1.9 --- src/games/atc/struct.h:1.8 Sat Mar 22 22:33:35 2014 +++ src/games/atc/struct.h Sat Mar 22 22:45:05 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: struct.h,v 1.8 2014/03/22 22:33:35 dholland Exp $ */ +/* $NetBSD: struct.h,v 1.9 2014/03/22 22:45:05 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -43,6 +43,8 @@ * For more info on this and all of my stuff, mail edja...@berkeley.edu. */ +#include + typedef struct { int x, y; int dir; /* used only sometimes */ @@ -86,8 +88,8 @@ typedef struct plane { int fuel; int xpos; int ypos; - int delayd; - int delayd_no; + bool delayd; + unsigned delayd_no; } PLANE; typedef struct { Index: src/games/atc/update.c diff -u src/games/atc/update.c:1.23 src/games/atc/update.c:1.24 --- src/games/atc/update.c:1.23 Sat Mar 22 22:24:21 2014 +++ src/games/atc/update.c Sat Mar 22 22:45:05 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: update.c,v 1.23 2014/03/22 22:24:21 dholland Exp $ */ +/* $NetBSD: update.c,v 1.24 2014/03/22 22:45:05 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,7 +46,7 @@ #if 0 static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: update.c,v 1.23 2014/03/22 22:24:21 dholland Exp $"); +__RCSID("$NetBSD: update.c,v 1.24 2014/03/22 22:45:05 dholland Exp $"); #endif #endif /* not lint */ @@ -124,7 +124,7 @@ update(int dummy __unused) if (pp->delayd && pp->xpos == sp->beacon[pp->delayd_no].x && pp->ypos == sp->beacon[pp->delayd_no].y) { - pp->delayd = 0; + pp->delayd = false; if (pp->status == S_UNMARKED) pp->status = S_MARKED; } @@ -249,7 +249,7 @@ command(const PLANE *pp) bp = strchr(buf, '\0'); bpsize = buf + sizeof(buf) - bp; if (pp->delayd) - (void)snprintf(bp, bpsize, " @ B%d", pp->delayd_no); + (void)snprintf(bp, bpsize, " @ B%u", pp->delayd_no); bp = strchr(buf, '\0'); bpsize = buf + sizeof(buf) - bp;
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Sat Mar 22 22:33:35 UTC 2014 Modified Files: src/games/atc: graphics.c struct.h Log Message: woops, more of previous. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/games/atc/graphics.c cvs rdiff -u -r1.7 -r1.8 src/games/atc/struct.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/graphics.c diff -u src/games/atc/graphics.c:1.17 src/games/atc/graphics.c:1.18 --- src/games/atc/graphics.c:1.17 Sat Mar 22 22:24:21 2014 +++ src/games/atc/graphics.c Sat Mar 22 22:33:35 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: graphics.c,v 1.17 2014/03/22 22:24:21 dholland Exp $ */ +/* $NetBSD: graphics.c,v 1.18 2014/03/22 22:33:35 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.17 2014/03/22 22:24:21 dholland Exp $"); +__RCSID("$NetBSD: graphics.c,v 1.18 2014/03/22 22:33:35 dholland Exp $"); #endif #endif /* not lint */ @@ -166,10 +166,10 @@ setup_screen(const C_SCREEN *scp) * through beacons and exit points. */ str[0] = C_LINE; - for (i = 0; i < scp->num_lines; i++) { + for (iu = 0; iu < scp->num_lines; iu++) { str[1] = ' '; - draw_line(radar, scp->line[i].p1.x, scp->line[i].p1.y, - scp->line[i].p2.x, scp->line[i].p2.y, str); + draw_line(radar, scp->line[iu].p1.x, scp->line[iu].p1.y, + scp->line[iu].p2.x, scp->line[iu].p2.y, str); } str[0] = C_TOPBOTTOM; Index: src/games/atc/struct.h diff -u src/games/atc/struct.h:1.7 src/games/atc/struct.h:1.8 --- src/games/atc/struct.h:1.7 Sat Mar 22 22:24:21 2014 +++ src/games/atc/struct.h Sat Mar 22 22:33:35 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: struct.h,v 1.7 2014/03/22 22:24:21 dholland Exp $ */ +/* $NetBSD: struct.h,v 1.8 2014/03/22 22:33:35 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -61,7 +61,7 @@ typedef struct { int update_secs; int newplane_time; unsigned num_exits; - int num_lines; + unsigned num_lines; unsigned num_beacons; unsigned num_airports; EXIT *exit;
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Sat Mar 22 22:24:21 UTC 2014 Modified Files: src/games/atc: graphics.c input.c struct.h update.c Log Message: Make some things unsigned that should be (why would we need e.g. a negative number of airports?) and remove some related bogus casts. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/games/atc/graphics.c cvs rdiff -u -r1.24 -r1.25 src/games/atc/input.c cvs rdiff -u -r1.6 -r1.7 src/games/atc/struct.h cvs rdiff -u -r1.22 -r1.23 src/games/atc/update.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/graphics.c diff -u src/games/atc/graphics.c:1.16 src/games/atc/graphics.c:1.17 --- src/games/atc/graphics.c:1.16 Wed Aug 12 04:48:03 2009 +++ src/games/atc/graphics.c Sat Mar 22 22:24:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: graphics.c,v 1.16 2009/08/12 04:48:03 dholland Exp $ */ +/* $NetBSD: graphics.c,v 1.17 2014/03/22 22:24:21 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.16 2009/08/12 04:48:03 dholland Exp $"); +__RCSID("$NetBSD: graphics.c,v 1.17 2014/03/22 22:24:21 dholland Exp $"); #endif #endif /* not lint */ @@ -130,6 +130,7 @@ void setup_screen(const C_SCREEN *scp) { int i, j; + unsigned iu; char str[3]; const char *airstr; @@ -193,22 +194,22 @@ setup_screen(const C_SCREEN *scp) } str[0] = C_BEACON; - for (i = 0; i < scp->num_beacons; i++) { - str[1] = '0' + i; - (void)wmove(radar, scp->beacon[i].y, scp->beacon[i].x * 2); + for (iu = 0; iu < scp->num_beacons; iu++) { + str[1] = '0' + iu; + (void)wmove(radar, scp->beacon[iu].y, scp->beacon[iu].x * 2); (void)waddstr(radar, str); } - for (i = 0; i < scp->num_exits; i++) { - (void)wmove(radar, scp->exit[i].y, scp->exit[i].x * 2); - (void)waddch(radar, '0' + i); + for (iu = 0; iu < scp->num_exits; iu++) { + (void)wmove(radar, scp->exit[iu].y, scp->exit[iu].x * 2); + (void)waddch(radar, '0' + iu); } airstr = "^?>?v?num_airports; i++) { - str[0] = airstr[scp->airport[i].dir]; - str[1] = '0' + i; - (void)wmove(radar, scp->airport[i].y, scp->airport[i].x * 2); + for (iu = 0; iu < scp->num_airports; iu++) { + str[0] = airstr[scp->airport[iu].dir]; + str[1] = '0' + iu; + (void)wmove(radar, scp->airport[iu].y, scp->airport[iu].x * 2); (void)waddstr(radar, str); } Index: src/games/atc/input.c diff -u src/games/atc/input.c:1.24 src/games/atc/input.c:1.25 --- src/games/atc/input.c:1.24 Wed Aug 12 04:48:03 2009 +++ src/games/atc/input.c Sat Mar 22 22:24:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: input.c,v 1.24 2009/08/12 04:48:03 dholland Exp $ */ +/* $NetBSD: input.c,v 1.25 2014/03/22 22:24:21 dholland 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.24 2009/08/12 04:48:03 dholland Exp $"); +__RCSID("$NetBSD: input.c,v 1.25 2014/03/22 22:24:21 dholland Exp $"); #endif #endif /* not lint */ @@ -459,36 +459,37 @@ Right(int c __unused) } static const char * -delayb(int c) +delayb(int ch) { int xdiff, ydiff; + unsigned bn; - c -= '0'; + bn = ch -= '0'; - if (c >= sp->num_beacons) + if (bn >= sp->num_beacons) return ("Unknown beacon"); - xdiff = sp->beacon[(int)c].x - p.xpos; + xdiff = sp->beacon[bn].x - p.xpos; xdiff = SGN(xdiff); - ydiff = sp->beacon[(int)c].y - p.ypos; + ydiff = sp->beacon[bn].y - p.ypos; ydiff = SGN(ydiff); if (xdiff != displacement[p.dir].dx || ydiff != displacement[p.dir].dy) return ("Beacon is not in flight path"); p.delayd = 1; - p.delayd_no = c; + p.delayd_no = bn; if (dest_type != T_NODEST) { switch (dest_type) { case T_BEACON: - xdiff = sp->beacon[dest_no].x - sp->beacon[(int)c].x; - ydiff = sp->beacon[dest_no].y - sp->beacon[(int)c].y; + xdiff = sp->beacon[dest_no].x - sp->beacon[bn].x; + ydiff = sp->beacon[dest_no].y - sp->beacon[bn].y; break; case T_EXIT: - xdiff = sp->exit[dest_no].x - sp->beacon[(int)c].x; - ydiff = sp->exit[dest_no].y - sp->beacon[(int)c].y; + xdiff = sp->exit[dest_no].x - sp->beacon[bn].x; + ydiff = sp->exit[dest_no].y - sp->beacon[bn].y; break; case T_AIRPORT: - xdiff = sp->airport[dest_no].x - sp->beacon[(int)c].x; - ydiff = sp->airport[dest_no].y - sp->beacon[(int)c].y; + xdiff = sp->airport[dest_no].x - sp->beacon[bn].x; + ydiff = sp->airport[dest_no].y - sp->beacon[bn].y; break; default: return ("Bad case in delayb! Get help!"); @@ -587,28 +588,31 @@ setrelalt(int c) } static const char * -benum(int c) +benum(int ch) { - dest_no = c -= '0'; + unsigned n; + + n = ch - '0'; + dest_no = n; switch (dest_type) { case T_BEACON: - if (c >= sp->num_beacons) + if (n >= sp->num_beacons) return ("Unknown beacon"); - p.new_dir =
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Sat Mar 22 22:09:14 UTC 2014 Modified Files: src/games/atc: grammar.y list.c Log Message: Don't cast the return value of malloc. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/games/atc/grammar.y cvs rdiff -u -r1.7 -r1.8 src/games/atc/list.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/grammar.y diff -u src/games/atc/grammar.y:1.10 src/games/atc/grammar.y:1.11 --- src/games/atc/grammar.y:1.10 Wed Aug 12 04:48:03 2009 +++ src/games/atc/grammar.y Sat Mar 22 22:09:14 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: grammar.y,v 1.10 2009/08/12 04:48:03 dholland Exp $ */ +/* $NetBSD: grammar.y,v 1.11 2014/03/22 22:09:14 dholland 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.10 2009/08/12 04:48:03 dholland Exp $"); +__RCSID("$NetBSD: grammar.y,v 1.11 2014/03/22 22:09:14 dholland Exp $"); #endif #endif /* not lint */ @@ -175,10 +175,10 @@ Bpoint: { if (sp->num_beacons % REALLOC == 0) { if (sp->beacon == NULL) -sp->beacon = (BEACON *) malloc((sp->num_beacons +sp->beacon = malloc((sp->num_beacons + REALLOC) * sizeof (BEACON)); else -sp->beacon = (BEACON *) realloc(sp->beacon, +sp->beacon = realloc(sp->beacon, (sp->num_beacons + REALLOC) * sizeof (BEACON)); if (sp->beacon == NULL) @@ -205,10 +205,10 @@ Epoint: if (sp->num_exits % REALLOC == 0) { if (sp->exit == NULL) -sp->exit = (EXIT *) malloc((sp->num_exits + +sp->exit = malloc((sp->num_exits + REALLOC) * sizeof (EXIT)); else -sp->exit = (EXIT *) realloc(sp->exit, +sp->exit = realloc(sp->exit, (sp->num_exits + REALLOC) * sizeof (EXIT)); if (sp->exit == NULL) @@ -238,10 +238,10 @@ Apoint: if (sp->num_airports % REALLOC == 0) { if (sp->airport == NULL) -sp->airport=(AIRPORT *)malloc((sp->num_airports +sp->airport = malloc((sp->num_airports + REALLOC) * sizeof(AIRPORT)); else -sp->airport = (AIRPORT *) realloc(sp->airport, +sp->airport = realloc(sp->airport, (sp->num_airports + REALLOC) * sizeof(AIRPORT)); if (sp->airport == NULL) @@ -268,10 +268,10 @@ Lline: { if (sp->num_lines % REALLOC == 0) { if (sp->line == NULL) -sp->line = (LINE *) malloc((sp->num_lines + +sp->line = malloc((sp->num_lines + REALLOC) * sizeof (LINE)); else -sp->line = (LINE *) realloc(sp->line, +sp->line = realloc(sp->line, (sp->num_lines + REALLOC) * sizeof (LINE)); if (sp->line == NULL) Index: src/games/atc/list.c diff -u src/games/atc/list.c:1.7 src/games/atc/list.c:1.8 --- src/games/atc/list.c:1.7 Fri Jul 1 00:48:34 2005 +++ src/games/atc/list.c Sat Mar 22 22:09:14 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: list.c,v 1.7 2005/07/01 00:48:34 jmc Exp $ */ +/* $NetBSD: list.c,v 1.8 2014/03/22 22:09:14 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,7 +46,7 @@ #if 0 static char sccsid[] = "@(#)list.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: list.c,v 1.7 2005/07/01 00:48:34 jmc Exp $"); +__RCSID("$NetBSD: list.c,v 1.8 2014/03/22 22:09:14 dholland Exp $"); #endif #endif /* not lint */ @@ -55,7 +55,7 @@ __RCSID("$NetBSD: list.c,v 1.7 2005/07/0 PLANE * newplane(void) { - return ((PLANE *) calloc(1, sizeof (PLANE))); + return calloc(1, sizeof (PLANE)); } void
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Fri Oct 12 10:44:20 UTC 2012 Modified Files: src/games/atc: main.c Log Message: Don't use ++ to set flags to true. Now passes -Wstrict-overflow. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/games/atc/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/main.c diff -u src/games/atc/main.c:1.20 src/games/atc/main.c:1.21 --- src/games/atc/main.c:1.20 Wed Aug 12 04:48:03 2009 +++ src/games/atc/main.c Fri Oct 12 10:44:20 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.20 2009/08/12 04:48:03 dholland Exp $ */ +/* $NetBSD: main.c,v 1.21 2012/10/12 10:44:20 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.20 2009/08/12 04:48:03 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.21 2012/10/12 10:44:20 dholland Exp $"); #endif #endif /* not lint */ @@ -90,17 +90,17 @@ main(int argc, char *argv[]) case '?': case 'u': default: - f_usage++; + f_usage = 1; break; case 'l': - f_list++; + f_list = 1; break; case 's': case 't': - f_showscore++; + f_showscore = 1; break; case 'p': - f_printpath++; + f_printpath = 1; break; case 'r': seed = atoi(optarg); @@ -112,7 +112,7 @@ main(int argc, char *argv[]) } } if (optind < argc) - f_usage++; + f_usage = 1; srandom(seed); if (f_usage)
CVS commit: src/games/atc
Module Name:src Committed By: christos Date: Tue Aug 16 10:14:40 UTC 2011 Modified Files: src/games/atc: Makefile Log Message: document non-literal format strings To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/games/atc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/Makefile diff -u src/games/atc/Makefile:1.29 src/games/atc/Makefile:1.30 --- src/games/atc/Makefile:1.29 Sat Feb 6 18:45:24 2010 +++ src/games/atc/Makefile Tue Aug 16 06:14:40 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.29 2010/02/06 23:45:24 he Exp $ +# $NetBSD: Makefile,v 1.30 2011/08/16 10:14:40 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 .include @@ -22,4 +22,6 @@ FILESMODE=444 .endif +COPTS.input.c += -Wno-format-nonliteral + .include
CVS commit: src/games/atc
Module Name:src Committed By: is Date: Tue Feb 15 08:25:26 UTC 2011 Modified Files: src/games/atc: update.c Log Message: Bug fix: in a game with 26 planes, the last one to be allocated wouldn't be allocated if it was the only eligible one. >From Jonathan David Amery via Debian Bug report 214626. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/games/atc/update.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/update.c diff -u src/games/atc/update.c:1.21 src/games/atc/update.c:1.22 --- src/games/atc/update.c:1.21 Wed Aug 12 04:48:03 2009 +++ src/games/atc/update.c Tue Feb 15 08:25:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: update.c,v 1.21 2009/08/12 04:48:03 dholland Exp $ */ +/* $NetBSD: update.c,v 1.22 2011/02/15 08:25:25 is Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,7 +46,7 @@ #if 0 static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: update.c,v 1.21 2009/08/12 04:48:03 dholland Exp $"); +__RCSID("$NetBSD: update.c,v 1.22 2011/02/15 08:25:25 is Exp $"); #endif #endif /* not lint */ @@ -302,7 +302,7 @@ break; } } while (found && last_plane != start_plane); - if (last_plane == start_plane) + if (found) return (-1); return (last_plane); }
CVS commit: src/games/atc
Module Name:src Committed By: christos Date: Thu Oct 29 14:27:26 UTC 2009 Modified Files: src/games/atc: Makefile lex.l Log Message: use %option noinput nounput To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/games/atc/Makefile cvs rdiff -u -r1.7 -r1.8 src/games/atc/lex.l Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/Makefile diff -u src/games/atc/Makefile:1.27 src/games/atc/Makefile:1.28 --- src/games/atc/Makefile:1.27 Mon Apr 20 12:05:29 2009 +++ src/games/atc/Makefile Thu Oct 29 10:27:26 2009 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.27 2009/04/20 16:05:29 drochner Exp $ +# $NetBSD: Makefile,v 1.28 2009/10/29 14:27:26 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 .include PROG= atc -CPPFLAGS+=-DBSD -I${.CURDIR} -I. -DYY_NO_UNPUT -DYY_NO_INPUT +CPPFLAGS+=-DBSD -I${.CURDIR} -I. SRCS= extern.c grammar.y graphics.c input.c lex.l list.c log.c \ main.c tunable.c update.c YHEADER=1 Index: src/games/atc/lex.l diff -u src/games/atc/lex.l:1.7 src/games/atc/lex.l:1.8 --- src/games/atc/lex.l:1.7 Thu Aug 7 05:36:54 2003 +++ src/games/atc/lex.l Thu Oct 29 10:27:26 2009 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: lex.l,v 1.7 2003/08/07 09:36:54 agc Exp $ */ +/* $NetBSD: lex.l,v 1.8 2009/10/29 14:27:26 christos Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -47,7 +47,7 @@ #if 0 static char sccsid[] = "@(#)lex.l 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: lex.l,v 1.7 2003/08/07 09:36:54 agc Exp $"); +__RCSID("$NetBSD: lex.l,v 1.8 2009/10/29 14:27:26 christos Exp $"); #endif #endif /* not lint */ @@ -58,6 +58,7 @@ extern int line; %} +%option nounput noinput %% [0-9]+ { yylval.ival = atoi(yytext); return(ConstOp); } height { return(HeightOp); }
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Wed Aug 12 04:48:03 UTC 2009 Modified Files: src/games/atc: extern.c extern.h grammar.y graphics.c input.c log.c main.c update.c Log Message: sprinkle static To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/games/atc/extern.c cvs rdiff -u -r1.15 -r1.16 src/games/atc/extern.h src/games/atc/graphics.c cvs rdiff -u -r1.9 -r1.10 src/games/atc/grammar.y cvs rdiff -u -r1.23 -r1.24 src/games/atc/input.c cvs rdiff -u -r1.20 -r1.21 src/games/atc/log.c src/games/atc/update.c cvs rdiff -u -r1.19 -r1.20 src/games/atc/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/extern.c diff -u src/games/atc/extern.c:1.10 src/games/atc/extern.c:1.11 --- src/games/atc/extern.c:1.10 Thu Jan 31 05:19:44 2008 +++ src/games/atc/extern.c Wed Aug 12 04:48:03 2009 @@ -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 @@ FILE *filein, *fileout; #endif -C_SCREEN screen, *sp = &screen; +static C_SCREEN screen; +C_SCREEN *sp = &screen; LIST air, ground; Index: src/games/atc/extern.h diff -u src/games/atc/extern.h:1.15 src/games/atc/extern.h:1.16 --- src/games/atc/extern.h:1.15 Mon May 25 23:48:32 2009 +++ src/games/atc/extern.h Wed Aug 12 04:48:03 2009 @@ -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 FILE *filein, *fileout; #endif -extern C_SCREEN screen, *sp; +extern C_SCREEN *sp; extern LIST air, ground; @@ -64,78 +64,35 @@ 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); Index: src/games/atc/graphics.c diff -u src/games/atc/graphics.c:1.15 src/games/atc/graphics.c:1.16 --- src/games/atc/graphics.c:1.15 Fri Aug 8 16:10:47 2008 +++ src/games/atc/graphics.c Wed Aug 12 04:48:03 2009 @@ -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:4
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Tue May 26 00:00:56 UTC 2009 Modified Files: src/games/atc: input.c log.c update.c Log Message: sprintf -> snprintf To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/games/atc/input.c cvs rdiff -u -r1.19 -r1.20 src/games/atc/log.c src/games/atc/update.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/input.c diff -u src/games/atc/input.c:1.22 src/games/atc/input.c:1.23 --- src/games/atc/input.c:1.22 Sat Dec 15 19:44:38 2007 +++ src/games/atc/input.c Tue May 26 00:00:56 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: input.c,v 1.22 2007/12/15 19:44:38 perry Exp $ */ +/* $NetBSD: input.c,v 1.23 2009/05/26 00:00:56 dholland 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.22 2007/12/15 19:44:38 perry Exp $"); +__RCSID("$NetBSD: input.c,v 1.23 2009/05/26 00:00:56 dholland Exp $"); #endif #endif /* not lint */ @@ -208,7 +208,8 @@ int newstate, newpos; assert(level < (MAXDEPTH - 1)); - (void)sprintf(T_STR, st[T_STATE].rule[ruleno].str, tval); + (void)snprintf(T_STR, sizeof(T_STR), + st[T_STATE].rule[ruleno].str, tval); T_RULE = ruleno; T_CH = ch; newstate = st[T_STATE].rule[ruleno].to_state; Index: src/games/atc/log.c diff -u src/games/atc/log.c:1.19 src/games/atc/log.c:1.20 --- src/games/atc/log.c:1.19 Sat Dec 15 19:44:38 2007 +++ src/games/atc/log.c Tue May 26 00:00:56 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: log.c,v 1.19 2007/12/15 19:44:38 perry Exp $ */ +/* $NetBSD: log.c,v 1.20 2009/05/26 00:00:56 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.19 2007/12/15 19:44:38 perry Exp $"); +__RCSID("$NetBSD: log.c,v 1.20 2009/05/26 00:00:56 dholland Exp $"); #endif #endif /* not lint */ @@ -84,13 +84,14 @@ static char s[80]; if (DAY(t) > 0) - (void)sprintf(s, "%dd+%02dhrs", DAY(t), HOUR(t)); + (void)snprintf(s, sizeof(s), "%dd+%02dhrs", DAY(t), HOUR(t)); else if (HOUR(t) > 0) - (void)sprintf(s, "%d:%02d:%02d", HOUR(t), MIN(t), SEC(t)); + (void)snprintf(s, sizeof(s), "%d:%02d:%02d", HOUR(t), MIN(t), + SEC(t)); else if (MIN(t) > 0) - (void)sprintf(s, "%d:%02d", MIN(t), SEC(t)); + (void)snprintf(s, sizeof(s), "%d:%02d", MIN(t), SEC(t)); else if (SEC(t) > 0) - (void)sprintf(s, ":%02d", SEC(t)); + (void)snprintf(s, sizeof(s), ":%02d", SEC(t)); else *s = '\0'; Index: src/games/atc/update.c diff -u src/games/atc/update.c:1.19 src/games/atc/update.c:1.20 --- src/games/atc/update.c:1.19 Sat Dec 15 19:44:38 2007 +++ src/games/atc/update.c Tue May 26 00:00:56 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: update.c,v 1.19 2007/12/15 19:44:38 perry Exp $ */ +/* $NetBSD: update.c,v 1.20 2009/05/26 00:00:56 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,7 +46,7 @@ #if 0 static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: update.c,v 1.19 2007/12/15 19:44:38 perry Exp $"); +__RCSID("$NetBSD: update.c,v 1.20 2009/05/26 00:00:56 dholland Exp $"); #endif #endif /* not lint */ @@ -201,7 +201,8 @@ if (too_close(p1, p2, 1)) { static char buf[80]; -(void)sprintf(buf, "collided with plane '%c'.", +(void)snprintf(buf, sizeof(buf), + "collided with plane '%c'.", name(p2)); loser(p1, buf); } @@ -222,29 +223,34 @@ command(const PLANE *pp) { static char buf[50], *bp, *comm_start; + size_t bpsize; buf[0] = '\0'; bp = buf; - (void)sprintf(bp, "%c%d%c%c%d: ", name(pp), pp->altitude, + bpsize = sizeof(buf); + (void)snprintf(bp, bpsize, "%c%d%c%c%d: ", name(pp), pp->altitude, (pp->fuel < LOWFUEL) ? '*' : ' ', (pp->dest_type == T_AIRPORT) ? 'A' : 'E', pp->dest_no); comm_start = bp = strchr(buf, '\0'); + bpsize = buf + sizeof(buf) - bp; if (pp->altitude == 0) - (void)sprintf(bp, "Holding @ A%d", pp->orig_no); + (void)snprintf(bp, bpsize, "Holding @ A%d", pp->orig_no); else if (pp->new_dir >= MAXDIR || pp->new_dir < 0) - (void)strcpy(bp, "Circle"); + (void)snprintf(bp, bpsize, "Circle"); else if (pp->new_dir != pp->dir) - (void)sprintf(bp, "%d", dir_deg(pp->new_dir)); + (void)snprintf(bp, bpsize, "%d", dir_deg(pp->new_dir)); bp = strchr(buf, '\0'); + bpsize = buf + sizeof(buf) - bp; if (pp->delayd) - (void)sprintf(bp, " @ B%d", pp->delayd_no); + (void)snprintf(bp, bpsize, " @ B%d", pp->delayd_no); bp = strchr(buf, '\0'); + bpsize = buf + sizeof(buf) - bp; if (*comm_start == '\0' && (pp->status == S_UNMARKED || pp->status == S_IGNORED)) - (void)strcpy(bp, "-"); + (void)snprintf(bp, bpsize, "-"); return (buf); }
CVS commit: src/games/atc
Module Name:src Committed By: dholland Date: Mon May 25 23:48:32 UTC 2009 Modified Files: src/games/atc: extern.h Log Message: attribute noreturn -> __dead To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/games/atc/extern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/extern.h diff -u src/games/atc/extern.h:1.14 src/games/atc/extern.h:1.15 --- src/games/atc/extern.h:1.14 Thu Jan 31 05:19:44 2008 +++ src/games/atc/extern.h Mon May 25 23:48:32 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.14 2008/01/31 05:19:44 dholland Exp $ */ +/* $NetBSD: extern.h,v 1.15 2009/05/25 23:48:32 dholland Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -89,8 +89,8 @@ void iomove(int); int list_games(void); int log_score(int); -void log_score_quit(int) __attribute__((__noreturn__)); -void loser(const PLANE *, const char *) __attribute__((__noreturn__)); +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);