Module Name:    src
Committed By:   dholland
Date:           Mon Jul 20 06:39:06 UTC 2009

Modified Files:
        src/games/robots: auto.c extern.c flush_in.c init_field.c main.c
            make_level.c move.c move_robs.c play_level.c query.c rnd_pos.c
            robots.h score.c

Log Message:
Assorted minor cleanups, no functional change:
   - u_int* -> uint*
   - don't make private typedefs of system structures
   - use curses TRUE and FALSE only with curses booleans, otherwise
     true and false;
   - includes cleanup
   - group globals in extern.c by functionality

Object file diffs inspected.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/games/robots/auto.c
cvs rdiff -u -r1.9 -r1.10 src/games/robots/extern.c \
    src/games/robots/make_level.c src/games/robots/move_robs.c
cvs rdiff -u -r1.8 -r1.9 src/games/robots/flush_in.c \
    src/games/robots/play_level.c src/games/robots/query.c
cvs rdiff -u -r1.11 -r1.12 src/games/robots/init_field.c
cvs rdiff -u -r1.27 -r1.28 src/games/robots/main.c
cvs rdiff -u -r1.14 -r1.15 src/games/robots/move.c
cvs rdiff -u -r1.7 -r1.8 src/games/robots/rnd_pos.c
cvs rdiff -u -r1.20 -r1.21 src/games/robots/robots.h src/games/robots/score.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/robots/auto.c
diff -u src/games/robots/auto.c:1.10 src/games/robots/auto.c:1.11
--- src/games/robots/auto.c:1.10	Mon Jul 20 06:00:56 2009
+++ src/games/robots/auto.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: auto.c,v 1.10 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: auto.c,v 1.11 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -50,6 +50,8 @@
  *			FI
  *		FI
  */
+#include <curses.h>
+#include <string.h>
 #include "robots.h"
 
 #define ABS(a) (((a)>0)?(a):-(a))

Index: src/games/robots/extern.c
diff -u src/games/robots/extern.c:1.9 src/games/robots/extern.c:1.10
--- src/games/robots/extern.c:1.9	Mon Jul 20 06:00:56 2009
+++ src/games/robots/extern.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.c,v 1.9 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: extern.c,v 1.10 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,45 +34,48 @@
 #if 0
 static char sccsid[] = "@(#)extern.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: extern.c,v 1.9 2009/07/20 06:00:56 dholland Exp $");
+__RCSID("$NetBSD: extern.c,v 1.10 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
 #include "robots.h"
 
+bool Real_time = false;		/* Play in real time? */
+bool Auto_bot = false;		/* Automatic mover */
+bool Jump = false;		/* Jump while running, counting, or waiting */
+bool Teleport = false;		/* Teleport automatically when player must */
+
 bool Dead;			/* Player is now dead */
-bool Full_clear = TRUE;		/* Lots of junk for init_field to clear */
-bool Jump = FALSE;		/* Jump while running, counting, or waiting */
+bool Running = false;		/* Currently in the middle of a run */
+bool Waiting;			/* Player is waiting for end */
 bool Newscore;			/* There was a new score added */
+bool Was_bonus = false;		/* Was a bonus last level */
+bool Full_clear = true;		/* Lots of junk for init_field to clear */
+
 #ifdef FANCY
-bool Pattern_roll = FALSE;	/* Auto play for YHBJNLUK pattern */
-#endif
-bool Real_time = FALSE;		/* Play in real time? */
-bool Auto_bot = FALSE;		/* Automatic mover */
-bool Running = FALSE;		/* Currently in the middle of a run */
-#ifdef FANCY
-bool Stand_still = FALSE;	/* Auto play for standing still pattern */
+bool Pattern_roll = false;	/* Auto play for YHBJNLUK pattern */
+bool Stand_still = false;	/* Auto play for standing still pattern */
 #endif
-bool Teleport = FALSE;		/* Teleport automatically when player must */
-bool Waiting;			/* Player is waiting for end */
-bool Was_bonus = FALSE;		/* Was a bonus last level */
 
 char Cnt_move;			/* Command which has preceded the count */
-char Field[Y_FIELDSIZE][X_FIELDSIZE];	/* the playing field itslef */
-const char  *Next_move;		/* Next move to be used in the pattern */
-const char *Move_list = "YHBJNLUK";/* List of moves in the pattern */
 char Run_ch;			/* Character for the direction we are running */
 
+char Field[Y_FIELDSIZE][X_FIELDSIZE];	/* the playing field itself */
+
+const char *Next_move;		/* Next move to be used in the pattern */
+const char *Move_list = "YHBJNLUK";/* List of moves in the pattern */
+
 int Count = 0;			/* Command count */
 int Level;			/* Current level */
 int Num_robots;			/* Number of robots left */
 int Num_scrap;			/* Number of scrap heaps */
 int Num_scores;			/* Number of scores posted */
 int Num_games;			/* Number of games to play */
-u_int32_t Score;		/* Current score */
 int Start_level = 1;		/* Level on which to start */
 int Wait_bonus;			/* bonus for waiting */
 
+uint32_t Score;			/* Current score */
+
 COORD Max;			/* Max area robots take up */
 COORD Min;			/* Min area robots take up */
 COORD My_pos;			/* Player's current position */
Index: src/games/robots/make_level.c
diff -u src/games/robots/make_level.c:1.9 src/games/robots/make_level.c:1.10
--- src/games/robots/make_level.c:1.9	Mon Jul 20 06:00:56 2009
+++ src/games/robots/make_level.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: make_level.c,v 1.9 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: make_level.c,v 1.10 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,10 +34,12 @@
 #if 0
 static char sccsid[] = "@(#)make_level.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: make_level.c,v 1.9 2009/07/20 06:00:56 dholland Exp $");
+__RCSID("$NetBSD: make_level.c,v 1.10 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <curses.h>
+#include <string.h>
 #include "robots.h"
 
 /*
@@ -59,7 +61,7 @@
 	if (My_pos.y > 0)
 		mvaddch(My_pos.y, My_pos.x, ' ');
 
-	Waiting = FALSE;
+	Waiting = false;
 	Wait_bonus = 0;
 	leaveok(stdscr, FALSE);
 	for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++)
Index: src/games/robots/move_robs.c
diff -u src/games/robots/move_robs.c:1.9 src/games/robots/move_robs.c:1.10
--- src/games/robots/move_robs.c:1.9	Mon Jul 20 06:00:56 2009
+++ src/games/robots/move_robs.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: move_robs.c,v 1.9 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: move_robs.c,v 1.10 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,10 +34,13 @@
 #if 0
 static char sccsid[] = "@(#)move_robs.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: move_robs.c,v 1.9 2009/07/20 06:00:56 dholland Exp $");
+__RCSID("$NetBSD: move_robs.c,v 1.10 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <curses.h>
+#include <signal.h>
+#include <unistd.h>
 #include "robots.h"
 
 /*
@@ -83,7 +86,7 @@
 		if (rp->y < 0)
 			continue;
 		else if (rp->y == My_pos.y && rp->x == My_pos.x)
-			Dead = TRUE;
+			Dead = true;
 		else if (Field[rp->y][rp->x] > 1) {
 			mvaddch(rp->y, rp->x, HEAP);
 			Scrap[Num_scrap++] = *rp;

Index: src/games/robots/flush_in.c
diff -u src/games/robots/flush_in.c:1.8 src/games/robots/flush_in.c:1.9
--- src/games/robots/flush_in.c:1.8	Mon Jul 20 06:00:56 2009
+++ src/games/robots/flush_in.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: flush_in.c,v 1.8 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: flush_in.c,v 1.9 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,10 +34,12 @@
 #if 0
 static char sccsid[] = "@(#)flush_in.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: flush_in.c,v 1.8 2009/07/20 06:00:56 dholland Exp $");
+__RCSID("$NetBSD: flush_in.c,v 1.9 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <stdio.h>
+#include <termios.h>
 #include "robots.h"
 
 /*
Index: src/games/robots/play_level.c
diff -u src/games/robots/play_level.c:1.8 src/games/robots/play_level.c:1.9
--- src/games/robots/play_level.c:1.8	Mon Jul 20 06:00:56 2009
+++ src/games/robots/play_level.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: play_level.c,v 1.8 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: play_level.c,v 1.9 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,10 +34,12 @@
 #if 0
 static char sccsid[] = "@(#)play_level.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: play_level.c,v 1.8 2009/07/20 06:00:56 dholland Exp $");
+__RCSID("$NetBSD: play_level.c,v 1.9 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <curses.h>
+#include <unistd.h>
 #include "robots.h"
 
 /*
@@ -77,15 +79,15 @@
 		if (Real_time)
 			alarm(0);
 		if (Field[My_pos.y][My_pos.x] != 0)
-			Dead = TRUE;
+			Dead = true;
 		if (!Dead)
-			move_robots(FALSE);
+			move_robots(false);
 		if (Was_bonus) {
 			move(Y_PROMPT, X_PROMPT);
 			clrtoeol();
 			move(Y_PROMPT + 1, X_PROMPT);
 			clrtoeol();
-			Was_bonus = FALSE;
+			Was_bonus = false;
 		}
 	}
 
@@ -94,14 +96,14 @@
 	 */
 
 	if (!Dead) {
-		Was_bonus = FALSE;
+		Was_bonus = false;
 
 		if (Level == Start_level && Start_level > 1) {
 			move(Y_PROMPT, X_PROMPT);
 			printw("Advance bonus: %d", S_BONUS);
 			refresh();
 			add_score(S_BONUS);
-			Was_bonus = TRUE;
+			Was_bonus = true;
 		}
 
 		if (Wait_bonus != 0) {
@@ -112,7 +114,7 @@
 			printw("Wait bonus: %d", Wait_bonus);
 			refresh();
 			add_score(Wait_bonus);
-			Was_bonus = TRUE;
+			Was_bonus = true;
 		}
 	}
 }
Index: src/games/robots/query.c
diff -u src/games/robots/query.c:1.8 src/games/robots/query.c:1.9
--- src/games/robots/query.c:1.8	Mon Jul 20 06:00:56 2009
+++ src/games/robots/query.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: query.c,v 1.8 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: query.c,v 1.9 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,10 +34,11 @@
 #if 0
 static char sccsid[] = "@(#)query.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: query.c,v 1.8 2009/07/20 06:00:56 dholland Exp $");
+__RCSID("$NetBSD: query.c,v 1.9 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <curses.h>
 #include "robots.h"
 
 /*

Index: src/games/robots/init_field.c
diff -u src/games/robots/init_field.c:1.11 src/games/robots/init_field.c:1.12
--- src/games/robots/init_field.c:1.11	Mon Jul 20 06:09:29 2009
+++ src/games/robots/init_field.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_field.c,v 1.11 2009/07/20 06:09:29 dholland Exp $	*/
+/*	$NetBSD: init_field.c,v 1.12 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,10 +34,11 @@
 #if 0
 static char sccsid[] = "@(#)init_field.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: init_field.c,v 1.11 2009/07/20 06:09:29 dholland Exp $");
+__RCSID("$NetBSD: init_field.c,v 1.12 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <curses.h>
 #include "robots.h"
 
 static int telx = 0;
@@ -52,7 +53,7 @@
 init_field(void)
 {
 	int i;
-	static bool first = TRUE;
+	static bool first = true;
 	static const char *const desc[] = {
 				"Directions:",
 				"",
@@ -79,8 +80,8 @@
 				NULL
 	};
 
-	Dead = FALSE;
-	Waiting = FALSE;
+	Dead = false;
+	Waiting = false;
 	Score = 0;
 
 	erase();
@@ -115,7 +116,7 @@
 	tely = i;
 	if (first)
 		refresh();
-	first = FALSE;
+	first = false;
 #ifdef FANCY
 	if (Pattern_roll)
 		Next_move = &Move_list[-1];

Index: src/games/robots/main.c
diff -u src/games/robots/main.c:1.27 src/games/robots/main.c:1.28
--- src/games/robots/main.c:1.27	Mon Jul 20 06:09:29 2009
+++ src/games/robots/main.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.27 2009/07/20 06:09:29 dholland Exp $	*/
+/*	$NetBSD: main.c,v 1.28 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,10 +39,18 @@
 #if 0
 static char sccsid[] = "@(#)main.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: main.c,v 1.27 2009/07/20 06:09:29 dholland Exp $");
+__RCSID("$NetBSD: main.c,v 1.28 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <ctype.h>
+#include <curses.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include "robots.h"
 
 extern const char *Scorefile;
@@ -66,10 +74,10 @@
 	/* Revoke setgid privileges */
 	setgid(getgid());
 
-	show_only = FALSE;
+	show_only = false;
 	Num_games = 1;
 	if (ac > 1) {
-		bad_arg = FALSE;
+		bad_arg = false;
 		for (++av; ac > 1 && *av[0]; av++, ac--)
 			if (av[0][0] != '-')
 				if (isdigit((unsigned char)av[0][0]))
@@ -86,24 +94,24 @@
 					if (sp == NULL)
 						sp = Scorefile;
 					if (strcmp(sp, "pattern_roll") == 0)
-						Pattern_roll = TRUE;
+						Pattern_roll = true;
 					else if (strcmp(sp, "stand_still") == 0)
-						Stand_still = TRUE;
+						Stand_still = true;
 					if (Pattern_roll || Stand_still)
-						Teleport = TRUE;
+						Teleport = true;
 #endif
 				}
 			else
 				for (sp = &av[0][1]; *sp; sp++)
 					switch (*sp) {
 					  case 'A':
-						Auto_bot = TRUE;
+						Auto_bot = true;
 						break;
 					  case 's':
-						show_only = TRUE;
+						show_only = true;
 						break;
 					  case 'r':
-						Real_time = TRUE;
+						Real_time = true;
 						break;
 					  case 'a':
 						Start_level = 4;
@@ -112,15 +120,15 @@
 						Num_games++;
 						break;
 					  case 'j':
-						Jump = TRUE;
+						Jump = true;
 						break;
 					  case 't':
-						Teleport = TRUE;
+						Teleport = true;
 						break;
 
 					  default:
 						fprintf(stderr, "robots: unknown option: %c\n", *sp);
-						bad_arg = TRUE;
+						bad_arg = true;
 						break;
 					}
 		if (bad_arg) {
@@ -211,7 +219,7 @@
 
 #ifdef FANCY
 	if ((Stand_still || Pattern_roll) && !Newscore)
-		return TRUE;
+		return true;
 #endif
 
 	if (query("Another game?")) {
@@ -222,7 +230,7 @@
 			}
 			refresh();
 		}
-		return TRUE;
+		return true;
 	}
-	return FALSE;
+	return false;
 }

Index: src/games/robots/move.c
diff -u src/games/robots/move.c:1.14 src/games/robots/move.c:1.15
--- src/games/robots/move.c:1.14	Mon Jul 20 06:00:56 2009
+++ src/games/robots/move.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: move.c,v 1.14 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: move.c,v 1.15 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,10 +34,15 @@
 #if 0
 static char sccsid[] = "@(#)move.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: move.c,v 1.14 2009/07/20 06:00:56 dholland Exp $");
+__RCSID("$NetBSD: move.c,v 1.15 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <sys/types.h>
+#include <sys/ttydefaults.h>  /* for CTRL */
+#include <ctype.h>
+#include <curses.h>
+#include <unistd.h>
 #include "robots.h"
 
 #define ESC	'\033'
@@ -151,7 +156,7 @@
 		  case 'Y': case 'U': case 'H': case 'J':
 		  case 'K': case 'L': case 'B': case 'N':
 		  case '>':
-			Running = TRUE;
+			Running = true;
 			if (c == '>')
 				Run_ch = ' ';
 			else
@@ -166,13 +171,13 @@
 			break;
 		  case 'w':
 		  case 'W':
-			Waiting = TRUE;
+			Waiting = true;
 			leaveok(stdscr, TRUE);
 			goto ret;
 		  case 't':
 		  case 'T':
 teleport:
-			Running = FALSE;
+			Running = false;
 			mvaddch(My_pos.y, My_pos.x, ' ');
 			My_pos = *rnd_pos();
 			telmsg(1);
@@ -215,7 +220,7 @@
 
 #ifdef FANCY
 	if (Stand_still && Num_robots > 1 && eaten(&My_pos))
-		return TRUE;
+		return true;
 #endif
 
 	for (y = -1; y <= 1; y++) {
@@ -229,10 +234,10 @@
 			if (Field[newpos.y][newpos.x] > 0)
 				continue;
 			if (!eaten(&newpos))
-				return FALSE;
+				return false;
 		}
 	}
-	return TRUE;
+	return true;
 }
 
 /*
@@ -250,7 +255,7 @@
 	    newpos.x <= 0 || newpos.x >= X_FIELDSIZE ||
 	    Field[newpos.y][newpos.x] > 0 || eaten(&newpos)) {
 		if (Running) {
-			Running = FALSE;
+			Running = false;
 			leaveok(stdscr, FALSE);
 			move(My_pos.y, My_pos.x);
 			refresh();
@@ -259,16 +264,16 @@
 			putchar(CTRL('G'));
 			reset_count();
 		}
-		return FALSE;
+		return false;
 	}
 	else if (dy == 0 && dx == 0)
-		return TRUE;
+		return true;
 	mvaddch(My_pos.y, My_pos.x, ' ');
 	My_pos = newpos;
 	mvaddch(My_pos.y, My_pos.x, PLAYER);
 	if (!jumping())
 		refresh();
-	return TRUE;
+	return true;
 }
 
 /*
@@ -287,10 +292,10 @@
 			if (x <= 0 || x >= X_FIELDSIZE)
 				continue;
 			if (Field[y][x] == 1)
-				return TRUE;
+				return true;
 		}
 	}
-	return FALSE;
+	return false;
 }
 
 /*
@@ -301,7 +306,7 @@
 reset_count(void)
 {
 	Count = 0;
-	Running = FALSE;
+	Running = false;
 	leaveok(stdscr, FALSE);
 	refresh();
 }

Index: src/games/robots/rnd_pos.c
diff -u src/games/robots/rnd_pos.c:1.7 src/games/robots/rnd_pos.c:1.8
--- src/games/robots/rnd_pos.c:1.7	Mon Jul 20 06:00:56 2009
+++ src/games/robots/rnd_pos.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rnd_pos.c,v 1.7 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: rnd_pos.c,v 1.8 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,10 +34,12 @@
 #if 0
 static char sccsid[] = "@(#)rnd_pos.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: rnd_pos.c,v 1.7 2009/07/20 06:00:56 dholland Exp $");
+__RCSID("$NetBSD: rnd_pos.c,v 1.8 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <curses.h>
+#include <stdlib.h>
 #include "robots.h"
 
 #define IS_SAME(p,y,x)	((p).y != -1 && (p).y == y && (p).x == x)

Index: src/games/robots/robots.h
diff -u src/games/robots/robots.h:1.20 src/games/robots/robots.h:1.21
--- src/games/robots/robots.h:1.20	Mon Jul 20 06:00:56 2009
+++ src/games/robots/robots.h	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: robots.h,v 1.20 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: robots.h,v 1.21 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -31,20 +31,11 @@
  *	@(#)robots.h	8.1 (Berkeley) 5/31/93
  */
 
-#include <sys/ttydefaults.h>
-#include <sys/endian.h>
-#include <ctype.h>
-#include <curses.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <pwd.h>
+#include <sys/cdefs.h>
+
 #include <setjmp.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <termios.h>
-#include <unistd.h>
+#include <stdbool.h>
+#include <stdint.h>
 
 /*
  * miscellaneous constants
@@ -84,15 +75,13 @@
 } COORD;
 
 typedef struct {
-	u_int32_t s_uid;
-	u_int32_t s_score;
-	u_int32_t s_auto;
-	u_int32_t s_level;
+	uint32_t s_uid;
+	uint32_t s_score;
+	uint32_t s_auto;
+	uint32_t s_level;
 	char s_name[MAXNAME];
 } SCORE;
 
-typedef struct passwd PASSWD;
-
 /*
  * global variables
  */
@@ -110,7 +99,7 @@
 extern int Count, Level, Num_robots, Num_scrap, Num_scores,
 	Start_level, Wait_bonus, Num_games;
 
-extern u_int32_t Score;
+extern uint32_t Score;
 
 extern COORD Max, Min, My_pos, Robots[], Scrap[];
 
Index: src/games/robots/score.c
diff -u src/games/robots/score.c:1.20 src/games/robots/score.c:1.21
--- src/games/robots/score.c:1.20	Mon Jul 20 06:00:56 2009
+++ src/games/robots/score.c	Mon Jul 20 06:39:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: score.c,v 1.20 2009/07/20 06:00:56 dholland Exp $	*/
+/*	$NetBSD: score.c,v 1.21 2009/07/20 06:39:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,10 +34,18 @@
 #if 0
 static char sccsid[] = "@(#)score.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: score.c,v 1.20 2009/07/20 06:00:56 dholland Exp $");
+__RCSID("$NetBSD: score.c,v 1.21 2009/07/20 06:39:06 dholland Exp $");
 #endif
 #endif /* not lint */
 
+#include <curses.h>
+#include <err.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 #include "robots.h"
 #include "pathnames.h"
 
@@ -47,10 +55,7 @@
 
 static SCORE Top[MAXSCORES];
 
-static u_int32_t numscores, max_uid;
-
-static void read_score(int);
-static void write_score(int);
+static uint32_t numscores, max_uid;
 
 /*
  * read_score:
@@ -114,10 +119,10 @@
 {
 	int inf = score_wfd;
 	SCORE *scp;
-	u_int32_t uid;
-	bool done_show = FALSE;
+	uint32_t uid;
+	bool done_show = false;
 
-	Newscore = FALSE;
+	Newscore = false;
 	if (inf < 0)
 		return;
 
@@ -135,7 +140,7 @@
 				scp->s_auto = Auto_bot;
 				scp->s_level = Level;
 				set_name(scp);
-				Newscore = TRUE;
+				Newscore = true;
 				break;
 			}
 		if (scp == &Top[MAXSCORES]) {
@@ -144,19 +149,19 @@
 			Top[MAXSCORES-1].s_auto = Auto_bot;
 			Top[MAXSCORES-1].s_level = Level;
 			set_name(&Top[MAXSCORES-1]);
-			Newscore = TRUE;
+			Newscore = true;
 		}
 		if (Newscore)
 			qsort(Top, MAXSCORES, sizeof Top[0], cmp_sc);
 	}
 
 	if (!Newscore) {
-		Full_clear = FALSE;
+		Full_clear = false;
 		lseek(inf, 0, SEEK_SET);
 		return;
 	}
 	else
-		Full_clear = TRUE;
+		Full_clear = true;
 
 	move(1, 15);
 	printw("%5.5s %5.5s %-9.9s %-8.8s %5.5s", "Rank", "Score", "User",
@@ -173,7 +178,7 @@
 		    scp->s_auto ? "(autobot)" : "", scp->s_level);
 		if (!done_show && scp->s_uid == uid && scp->s_score == Score) {
 			standend();
-			done_show = TRUE;
+			done_show = true;
 		}
 	}
 	Num_scores = scp - Top;
@@ -188,7 +193,7 @@
 void
 set_name(SCORE *scp)
 {
-	PASSWD *pp;
+	struct passwd *pp;
 
 	if ((pp = getpwuid(scp->s_uid)) == NULL)
 		strncpy(scp->s_name, "???", MAXNAME);

Reply via email to