DragonFly BSD
DragonFly submit List (threaded) for 2005-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

games/trek WARNS=6 patch


From: hakonsb@xxxxxxxxxxxxxxxxxxxxx
Date: Thu, 31 Mar 2005 21:11:32 +0200 (CEST)

Hi,

This patch should clean up the games/trek code. It basically just removes
the warnings, with some cosmetic changes in the most messy parts. I see
that the patch got quite big; please let me know if I got a bit carried
away.

-- 
Haakon Schad Bergsaker
Index: Makefile
===================================================================
RCS file: /home/dcvs/src/games/trek/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile	17 Jun 2003 04:25:25 -0000	1.2
+++ Makefile	26 Mar 2005 18:23:16 -0000
@@ -10,10 +10,11 @@
 	lose.c lrscan.c main.c move.c nova.c out.c phaser.c play.c ram.c \
 	ranf.c rest.c schedule.c score.c setup.c setwarp.c \
 	shield.c snova.c srscan.c systemname.c torped.c utility.c \
-	visual.c warp.c win.c cgetc.c
+	visual.c warp.c win.c
 MAN=	trek.6
 DPADD=	${LIBM} ${LIBCOMPAT}
 LDADD=	-lm -lcompat
 HIDEGAME=hidegame
+WARNS?= 6
 
 .include <bsd.prog.mk>
Index: abandon.c
===================================================================
RCS file: /home/dcvs/src/games/trek/abandon.c,v
retrieving revision 1.2
diff -u -r1.2 abandon.c
--- abandon.c	17 Jun 2003 04:25:25 -0000	1.2
+++ abandon.c	25 Mar 2005 16:11:05 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/abandon.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  Abandon Ship
@@ -62,19 +62,26 @@
 **	Uses trace flag 40
 */
 
-abandon()
+void
+abandon(void)
 {
 	struct quad	*q;
 	int		i;
-	int			j;
+	int		j;
 	struct event	*e;
 
 	if (Ship.ship == QUEENE)
-		return (printf("You may not abandon ye Faire Queene\n"));
+	{
+		printf("You may not abandon ye Faire Queene\n");
+		return;
+	}
 	if (Ship.cond != DOCKED)
 	{
 		if (damaged(SHUTTLE))
-			return (out(SHUTTLE));
+		{
+			out(SHUTTLE);
+			return;
+		}
 		printf("Officers escape in shuttlecraft\n");
 		/* decide on fate of crew */
 		q = &Quad[Ship.quadx][Ship.quady];
Index: attack.c
===================================================================
RCS file: /home/dcvs/src/games/trek/attack.c,v
retrieving revision 1.2
diff -u -r1.2 attack.c
--- attack.c	17 Jun 2003 04:25:25 -0000	1.2
+++ attack.c	26 Mar 2005 22:05:22 -0000
@@ -35,7 +35,8 @@
  * $DragonFly: src/games/trek/attack.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <math.h>
+#include "trek.h"
 
 /*
 **  Klingon Attack Routine
@@ -67,8 +68,8 @@
 **	Casualties can also occur.
 */
 
-attack(resting)
-int	resting;	/* set if attack while resting */
+void
+attack(int resting)
 {
 	int		hit, i, l;
 	int			maxhit, tothit, shldabsb;
Index: autover.c
===================================================================
RCS file: /home/dcvs/src/games/trek/autover.c,v
retrieving revision 1.2
diff -u -r1.2 autover.c
--- autover.c	17 Jun 2003 04:25:25 -0000	1.2
+++ autover.c	25 Mar 2005 16:11:50 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/autover.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  Automatic Override
@@ -55,7 +55,8 @@
 **	quadrants, since that is all that is needed.
 */
 
-autover()
+void
+autover(void)
 {
 	double			dist;
 	int		course;
Index: capture.c
===================================================================
RCS file: /home/dcvs/src/games/trek/capture.c,v
retrieving revision 1.2
diff -u -r1.2 capture.c
--- capture.c	17 Jun 2003 04:25:25 -0000	1.2
+++ capture.c	25 Mar 2005 17:06:59 -0000
@@ -35,7 +35,10 @@
  * $DragonFly: src/games/trek/capture.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
+
+
+static struct kling	*selectklingon(void);
 
 /*
 **  Ask a Klingon To Surrender
@@ -51,12 +54,12 @@
 **	etc.
 */
 
-capture()
+void
+capture(void)
 {
 	int		i;
 	struct kling	*k;
 	double			x;
-	extern struct kling	*selectklingon();
 
 	/* check for not cloaked */
 	if (Ship.cloaked)
@@ -85,10 +88,10 @@
 	x /= k->power * Etc.nkling;
 	x *= Param.srndrprob;
 	i = x;
-#	ifdef xTRACE
+#ifdef xTRACE
 	if (Trace)
 		printf("Prob = %d (%.4f)\n", i, x);
-#	endif
+#endif
 	if (i > ranf(100))
 	{
 		/* guess what, he surrendered!!! */
@@ -116,7 +119,8 @@
 **	Cruddy, just takes one at random.  Should ask the captain.
 */
 
-struct kling	*selectklingon()
+struct kling *
+selectklingon(void)
 {
 	int		i;
 
Index: check_out.c
===================================================================
RCS file: /home/dcvs/src/games/trek/check_out.c,v
retrieving revision 1.2
diff -u -r1.2 check_out.c
--- check_out.c	17 Jun 2003 04:25:25 -0000	1.2
+++ check_out.c	25 Mar 2005 16:13:50 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/check_out.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  CHECK IF A DEVICE IS OUT
@@ -48,8 +48,8 @@
 **	It prints appropriate messages too.
 */
 
-check_out(device)
-int	device;
+int
+check_out(int device)
 {
 	int	dev;
 
Index: checkcond.c
===================================================================
RCS file: /home/dcvs/src/games/trek/checkcond.c,v
retrieving revision 1.2
diff -u -r1.2 checkcond.c
--- checkcond.c	17 Jun 2003 04:25:25 -0000	1.2
+++ checkcond.c	25 Mar 2005 17:10:34 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/checkcond.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  Check for Condition After a Move
@@ -62,10 +62,9 @@
 **	and battle conditions.
 */
 
-checkcond()
+void
+checkcond(void)
 {
-	int		i, j;
-
 	/* see if we are still alive and well */
 	if (Ship.reserves < 0.0)
 		lose(L_NOLIFE);
@@ -100,5 +99,4 @@
 		return;
 	}
 	Ship.cond = GREEN;
-	return;
 }
Index: compkl.c
===================================================================
RCS file: /home/dcvs/src/games/trek/compkl.c,v
retrieving revision 1.2
diff -u -r1.2 compkl.c
--- compkl.c	17 Jun 2003 04:25:25 -0000	1.2
+++ compkl.c	31 Mar 2005 20:49:15 -0000
@@ -35,7 +35,11 @@
  * $DragonFly: src/games/trek/compkl.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <string.h>
+#include <math.h>
+#include "trek.h"
+
+static void	sortkl(void);
 
 /*
 **  compute klingon distances
@@ -48,8 +52,8 @@
 **	move.
 */
 
-compkldist(f)
-int	f;		/* set if new quadrant */
+void
+compkldist(int f)
 {
 	int		i, dx, dy;
 	double			d;
@@ -90,7 +94,8 @@
 **	bubble sort on ascending distance
 */
 
-sortkl()
+void
+sortkl(void)
 {
 	struct kling		t;
 	int		f, i, m;
@@ -103,9 +108,9 @@
 		for (i = 0; i < m; i++)
 			if (Etc.klingon[i].dist > Etc.klingon[i+1].dist)
 			{
-				bmove(&Etc.klingon[i], &t, sizeof t);
-				bmove(&Etc.klingon[i+1], &Etc.klingon[i], sizeof t);
-				bmove(&t, &Etc.klingon[i+1], sizeof t);
+				memmove(&t, &Etc.klingon[i], sizeof t);
+				memmove(&Etc.klingon[i], &Etc.klingon[i+1], sizeof t);
+				memmove(&Etc.klingon[i+1], &t, sizeof t);
 				f = 1;
 			}
 	}
Index: computer.c
===================================================================
RCS file: /home/dcvs/src/games/trek/computer.c,v
retrieving revision 1.2
diff -u -r1.2 computer.c
--- computer.c	17 Jun 2003 04:25:25 -0000	1.2
+++ computer.c	26 Mar 2005 22:07:20 -0000
@@ -35,9 +35,11 @@
  * $DragonFly: src/games/trek/computer.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	"getpar.h"
-# include	<stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
+
 /*
 **  On-Board Computer
 **
@@ -86,23 +88,28 @@
 
 struct cvntab	Cputab[] =
 {
-	"ch",			"art",			(int (*)())1,		0,
-	"t",			"rajectory",		(int (*)())2,		0,
-	"c",			"ourse",		(int (*)())3,		0,
-	"m",			"ove",			(int (*)())3,		1,
-	"s",			"core",			(int (*)())4,		0,
-	"p",			"heff",			(int (*)())5,		0,
-	"w",			"arpcost",		(int (*)())6,		0,
-	"i",			"mpcost",		(int (*)())7,		0,
-	"d",			"istresslist",		(int (*)())8,		0,
-	0
+	{"ch",	"art",		(void (*)())1,	0},
+	{"t",	"rajectory",	(void (*)())2,	0},
+	{"c",	"ourse",	(void (*)())3,	0},
+	{"m",	"ove",		(void (*)())3,	1},
+	{"s",	"core",		(void (*)())4,	0},
+	{"p",	"heff",		(void (*)())5,	0},
+	{"w",	"arpcost",	(void (*)())6,	0},
+	{"i",	"mpcost",	(void (*)())7,	0},
+	{"d",	"istresslist",	(void (*)())8,	0},
+	{0,	0,		(void (*)())0,	0}
 };
 
-computer()
+
+static int	kalc(int tqx, int tqy, int tsx, int tsy, double *dist);
+void		prkalc(int course, double dist);
+
+
+void
+computer(void)
 {
 	int			ix, iy;
 	int		i, j;
-	int			numout;
 	int			tqx, tqy;
 	struct cvntab		*r;
 	int			cost;
@@ -284,7 +291,7 @@
 		/* skip to next semicolon or newline.  Semicolon
 		 * means get new computer request; newline means
 		 * exit computer mode. */
-		while ((i = cgetc(0)) != ';')
+		while ((i = getchar()) != ';')
 		{
 			if (i == '\0')
 				exit(1);
@@ -305,12 +312,8 @@
 **	sqx,sqy/ssx,ssy to tqx,tqy/tsx,tsy.
 */
 
-kalc(tqx, tqy, tsx, tsy, dist)
-int	tqx;
-int	tqy;
-int	tsx;
-int	tsy;
-double	*dist;
+int
+kalc(int tqx, int tqy, int tsx, int tsy, double *dist)
 {
 	double			dx, dy;
 	double			quadsize;
@@ -334,10 +337,8 @@
 	return (course);
 }
 
-
-prkalc(course, dist)
-int	course;
-double	dist;
+void
+prkalc(int course, double dist)
 {
 	printf(": course %d  dist %.3f\n", course, dist);
 }
Index: damage.c
===================================================================
RCS file: /home/dcvs/src/games/trek/damage.c,v
retrieving revision 1.2
diff -u -r1.2 damage.c
--- damage.c	17 Jun 2003 04:25:25 -0000	1.2
+++ damage.c	25 Mar 2005 16:20:49 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/damage.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  Schedule Ship.damages to a Device
@@ -49,9 +49,8 @@
 **	that the dock() and undock() have to reschedule the event.
 */
 
-damage(dev1, dam)
-int	dev1;		/*  device index */
-double	dam;		/* time to repair */
+void
+damage(int dev1, double dam)
 {
 	int		i;
 	struct event	*e;
Index: damaged.c
===================================================================
RCS file: /home/dcvs/src/games/trek/damaged.c,v
retrieving revision 1.2
diff -u -r1.2 damaged.c
--- damaged.c	17 Jun 2003 04:25:25 -0000	1.2
+++ damaged.c	25 Mar 2005 16:21:08 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/damaged.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*  DAMAGED -- check for device damaged
 **
@@ -44,8 +44,8 @@
 **	event list for a "device fix" action on that device.
 */
 
-damaged(dev)
-int	dev;
+int
+damaged(int dev)
 {
 	int		d;
 	struct event	*e;
Index: dcrept.c
===================================================================
RCS file: /home/dcvs/src/games/trek/dcrept.c,v
retrieving revision 1.2
diff -u -r1.2 dcrept.c
--- dcrept.c	17 Jun 2003 04:25:25 -0000	1.2
+++ dcrept.c	25 Mar 2005 16:21:38 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/dcrept.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  damage control report
@@ -49,7 +49,8 @@
 **	fix things if you are docked.
 */
 
-dcrept()
+void
+dcrept(void)
 {
 	int		i, f;
 	double			x;
Index: destruct.c
===================================================================
RCS file: /home/dcvs/src/games/trek/destruct.c,v
retrieving revision 1.2
diff -u -r1.2 destruct.c
--- destruct.c	17 Jun 2003 04:25:25 -0000	1.2
+++ destruct.c	26 Mar 2005 18:59:41 -0000
@@ -35,7 +35,10 @@
  * $DragonFly: src/games/trek/destruct.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <unistd.h>
+#include <string.h>
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  Self Destruct Sequence
@@ -57,14 +60,18 @@
 **	Uses trace flag 41
 */
 
-destruct()
+void
+destruct(void)
 {
 	char		checkpass[15];
 	int	i, j;
 	double		zap;
 
 	if (damaged(COMPUTER))
-		return (out(COMPUTER));
+	{
+		out(COMPUTER);
+		return;
+	}
 	printf("\n\07 --- WORKING ---\07\n");
 	sleep(3);
 	/* output the count 10 9 8 7 6 */
@@ -79,8 +86,11 @@
 	skiptonl(0);
 	getstrpar("Enter password verification", checkpass, 14, 0);
 	sleep(2);
-	if (!sequal(checkpass, Game.passwd))
-		return (printf("Self destruct sequence aborted\n"));
+	if (strcmp(checkpass, Game.passwd))
+	{
+		printf("Self destruct sequence aborted\n");
+		return;
+	}
 	printf("Password verified; self destruct sequence continues:\n");
 	sleep(2);
 	/* output count 5 4 3 2 1 0 */
Index: dock.c
===================================================================
RCS file: /home/dcvs/src/games/trek/dock.c,v
retrieving revision 1.2
diff -u -r1.2 dock.c
--- dock.c	17 Jun 2003 04:25:25 -0000	1.2
+++ dock.c	26 Mar 2005 17:27:49 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/dock.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  DOCK TO STARBASE
@@ -52,14 +52,18 @@
 **	are docked.
 */
 
-dock()
+void
+dock(void)
 {
 	int		i, j;
 	int			ok;
 	struct event	*e;
 
 	if (Ship.cond == DOCKED)
-		return (printf("Chekov: But captain, we are already docked\n"));
+	{
+		printf("Chekov: But captain, we are already docked\n");
+		return;
+	}
 	/* check for ok to dock, i.e., adjacent to a starbase */
 	ok = 0;
 	for (i = Ship.sectx - 1; i <= Ship.sectx + 1 && !ok; i++)
@@ -78,7 +82,10 @@
 		}
 	}
 	if (!ok)
-		return (printf("Chekov: But captain, we are not adjacent to a starbase.\n"));
+	{
+		printf("Chekov: But captain, we are not adjacent to a starbase.\n");
+		return;
+	}
 
 	/* restore resources */
 	Ship.energy = Param.energy;
@@ -108,7 +115,6 @@
 			continue;
 		reschedule(e, (e->date - Now.date) * Param.dockfac);
 	}
-	return;
 }
 
 
@@ -119,7 +125,8 @@
 **	is to reschedule any damages so that they will take longer.
 */
 
-undock()
+void
+undock(void)
 {
 	struct event	*e;
 	int		i;
@@ -140,5 +147,4 @@
 			continue;
 		reschedule(e, (e->date - Now.date) / Param.dockfac);
 	}
-	return;
 }
Index: dumpgame.c
===================================================================
RCS file: /home/dcvs/src/games/trek/dumpgame.c,v
retrieving revision 1.2
diff -u -r1.2 dumpgame.c
--- dumpgame.c	17 Jun 2003 04:25:25 -0000	1.2
+++ dumpgame.c	26 Mar 2005 22:04:34 -0000
@@ -35,12 +35,12 @@
  * $DragonFly: src/games/trek/dumpgame.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
+#include <unistd.h>
 #include <fcntl.h>
-
-# include	"trek.h"
+#include "trek.h"
 
 /***  THIS CONSTANT MUST CHANGE AS THE DATA SPACES CHANGE ***/
-# define	VERSION		2
+#define	VERSION		2
 
 struct dump
 {
@@ -51,18 +51,22 @@
 
 struct dump	Dump_template[] =
 {
-	(char *)&Ship,		sizeof (Ship),
-	(char *)&Now,		sizeof (Now),
-	(char *)&Param,		sizeof (Param),
-	(char *)&Etc,		sizeof (Etc),
-	(char *)&Game,		sizeof (Game),
-	(char *)Sect,		sizeof (Sect),
-	(char *)Quad,		sizeof (Quad),
-	(char *)&Move,		sizeof (Move),
-	(char *)Event,		sizeof (Event),
-	0
+	{(char *)&Ship,		sizeof (Ship)},
+	{(char *)&Now,		sizeof (Now)},
+	{(char *)&Param,		sizeof (Param)},
+	{(char *)&Etc,		sizeof (Etc)},
+	{(char *)&Game,		sizeof (Game)},
+	{(char *)Sect,		sizeof (Sect)},
+	{(char *)Quad,		sizeof (Quad)},
+	{(char *)&Move,		sizeof (Move)},
+	{(char *)Event,		sizeof (Event)},
+	{0,			0}
 };
 
+
+static int	readdump(int fd1);
+
+
 /*
 **  DUMP GAME
 **
@@ -73,7 +77,8 @@
 **	output change.
 */
 
-dumpgame()
+void
+dumpgame(void)
 {
 	int			version;
 	int		fd;
@@ -81,7 +86,10 @@
 	int		i;
 
 	if ((fd = creat("trek.dump", 0644)) < 0)
-		return (printf("cannot dump\n"));
+	{
+		printf("cannot dump\n");
+		return;
+	}
 	version = VERSION;
 	write(fd, &version, sizeof version);
 
@@ -108,7 +116,8 @@
 **	Return value is zero for success, one for failure.
 */
 
-restartgame()
+int
+restartgame(void)
 {
 	int	fd;
 	int		version;
@@ -137,8 +146,8 @@
 **	Returns zero for success, one for failure.
 */
 
-readdump(fd1)
-int	fd1;
+int
+readdump(int fd1)
 {
 	int		fd;
 	struct dump	*d;
Index: dumpme.c
===================================================================
RCS file: /home/dcvs/src/games/trek/dumpme.c,v
retrieving revision 1.2
diff -u -r1.2 dumpme.c
--- dumpme.c	17 Jun 2003 04:25:25 -0000	1.2
+++ dumpme.c	26 Mar 2005 17:26:01 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/dumpme.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  Dump the starship somewhere in the galaxy
@@ -49,8 +49,8 @@
 **	Repair of devices must be deferred.
 */
 
-dumpme(flag)
-int	flag;
+void
+dumpme(int flag)
 {
 	int		f;
 	double			x;
@@ -62,7 +62,7 @@
 	Ship.quady = ranf(NQUADS);
 	Ship.sectx = ranf(NSECTS);
 	Ship.secty = ranf(NSECTS);
-	x += 1.5 * franf();
+	x = 1.5 * franf();
 	Move.time += x;
 	if (f)
 	{
Index: dumpssradio.c
===================================================================
RCS file: /home/dcvs/src/games/trek/dumpssradio.c,v
retrieving revision 1.2
diff -u -r1.2 dumpssradio.c
--- dumpssradio.c	17 Jun 2003 04:25:25 -0000	1.2
+++ dumpssradio.c	26 Mar 2005 22:03:27 -0000
@@ -35,13 +35,14 @@
  * $DragonFly: src/games/trek/dumpssradio.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /**
  **	output hidden distress calls
  **/
 
-dumpssradio()
+int
+dumpssradio(void)
 {
 	struct event	*e;
 	int		j;
@@ -58,7 +59,7 @@
 		{
 			unschedule(e);
 			printf("Starsystem %s in quadrant %d,%d is no longer distressed\n",
-				systemname(e), e->x, e->y);
+				systemname(&Quad[e->x][e->y]), e->x, e->y);
 			continue;
 		}
 
@@ -74,7 +75,7 @@
 		  case E_ENSLV:
 		  case E_REPRO:
 			printf("Starsystem %s in quadrant %d,%d is distressed\n",
-				systemname(e), e->x, e->y);
+				systemname(&Quad[e->x][e->y]), e->x, e->y);
 			chkrest++;
 			break;
 
Index: events.c
===================================================================
RCS file: /home/dcvs/src/games/trek/events.c,v
retrieving revision 1.2
diff -u -r1.2 events.c
--- events.c	17 Jun 2003 04:25:25 -0000	1.2
+++ events.c	31 Mar 2005 20:36:59 -0000
@@ -35,7 +35,10 @@
  * $DragonFly: src/games/trek/events.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <string.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  CAUSE TIME TO ELAPSE
@@ -45,9 +48,8 @@
 **	and so on.
 */
 
-
-events(warp)
-int	warp;		/* set if called in a time warp */
+int
+events(int _warp)
 {
 	int		i;
 	int			j;
@@ -55,12 +57,13 @@
 	double			rtime;
 	double			xdate;
 	double			idate;
-	struct event		*ev, *xsched(), *schedule();
+	struct event		*ev;
 	int			ix, iy;
 	struct quad	*q;
 	struct event	*e;
 	int			evnum;
 	int			restcancel;
+	char		*p;
 
 	/* if nothing happened, just allow for any Klingons killed */
 	if (Move.time <= 0.0)
@@ -80,6 +83,8 @@
 		schedule(E_ATTACK, 0.5, 0, 0, 0);
 
 	/* scan the event list */
+	j = 0;
+	ev = NULL;
 	while (1)
 	{
 		restcancel = 0;
@@ -116,11 +121,11 @@
 		/* check for out of time */
 		if (Now.time <= 0.0)
 			lose(L_NOTIME);
-#		ifdef xTRACE
+#ifdef xTRACE
 		if (evnum >= 0 && Trace)
 			printf("xdate = %.2f, evcode %d params %d %d %d\n",
 				xdate, e->evcode, e->x, e->y, e->systemname);
-#		endif
+#endif
 
 		/* if evnum < 0, no events occurred  */
 		if (evnum < 0)
@@ -132,7 +137,7 @@
 
 		  case E_SNOVA:			/* supernova */
 			/* cause the supernova to happen */
-			snova(-1);
+			snova(-1, 0);
 			/* and schedule the next one */
 			xresched(e, E_SNOVA, 1);
 			break;
@@ -383,10 +388,10 @@
 
 		  case E_SNAP:		/* take a snapshot of the galaxy */
 			xresched(e, E_SNAP, 1);
-			i = (int) Etc.snapshot;
-			i = bmove(Quad, i, sizeof (Quad));
-			i = bmove(Event, i, sizeof (Event));
-			i = bmove(&Now, i, sizeof (Now));
+			p = Etc.snapshot;
+			memmove(p, Quad, sizeof (Quad));
+			memmove(p += sizeof(Quad), Event, sizeof (Event));
+			memmove(p += sizeof(Event), &Now, sizeof (Now));
 			Game.snap = 1;
 			break;
 
@@ -441,10 +446,10 @@
 	}
 
 	/* unschedule an attack during a rest period */
-	if (e = Now.eventptr[E_ATTACK])
+	if ((e = Now.eventptr[E_ATTACK]))
 		unschedule(e);
 
-	if (!warp)
+	if (!_warp)
 	{
 		/* eat up energy if cloaked */
 		if (Ship.cloaked)
Index: externs.c
===================================================================
RCS file: /home/dcvs/src/games/trek/externs.c,v
retrieving revision 1.2
diff -u -r1.2 externs.c
--- externs.c	17 Jun 2003 04:25:25 -0000	1.2
+++ externs.c	25 Mar 2005 19:23:49 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/externs.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **	global variable definitions
@@ -43,25 +43,25 @@
 
 struct device	Device[NDEV] =
 {
-	"warp drive",		"Scotty",
-	"S.R. scanners",	"Scotty",
-	"L.R. scanners",	"Scotty",
-	"phasers",		"Sulu",
-	"photon tubes",		"Sulu",
-	"impulse engines",	"Scotty",
-	"shield control",	"Sulu",
-	"computer",		"Spock",
-	"subspace radio",	"Uhura",
-	"life support",		"Scotty",
-	"navigation system",	"Chekov",
-	"cloaking device",	"Scotty",
-	"transporter",		"Scotty",
-	"shuttlecraft",		"Scotty",
-	"*ERR 14*",		"Nobody",
-	"*ERR 15*",		"Nobody"
+	{"warp drive",		"Scotty"},
+	{"S.R. scanners",	"Scotty"},
+	{"L.R. scanners",	"Scotty"},
+	{"phasers",		"Sulu"},
+	{"photon tubes",	"Sulu"},
+	{"impulse engines",	"Scotty"},
+	{"shield control",	"Sulu"},
+	{"computer",		"Spock"},
+	{"subspace radio",	"Uhura"},
+	{"life support",	"Scotty"},
+	{"navigation system",	"Chekov"},
+	{"cloaking device",	"Scotty"},
+	{"transporter",		"Scotty"},
+	{"shuttlecraft",	"Scotty"},
+	{"*ERR 14*",		"Nobody"},
+	{"*ERR 15*",		"Nobody"}
 };
 
-char	*Systemname[NINHAB] =
+const char	*Systemname[NINHAB] =
 {
 	"ERROR",
 	"Talos IV",
Index: getcodi.c
===================================================================
RCS file: /home/dcvs/src/games/trek/getcodi.c,v
retrieving revision 1.2
diff -u -r1.2 getcodi.c
--- getcodi.c	17 Jun 2003 04:25:25 -0000	1.2
+++ getcodi.c	25 Mar 2005 16:29:54 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/getcodi.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"getpar.h"
+#include "getpar.h"
 
 /*
 **  get course and distance
@@ -47,9 +47,8 @@
 **	(meaning to drop the request).
 */
 
-getcodi(co, di)
-int	*co;
-double	*di;
+int
+getcodi(int *co, double *di)
 {
 
 	*co = getintpar("Course");
Index: getpar.c
===================================================================
RCS file: /home/dcvs/src/games/trek/getpar.c,v
retrieving revision 1.2
diff -u -r1.2 getpar.c
--- getpar.c	17 Jun 2003 04:25:25 -0000	1.2
+++ getpar.c	30 Mar 2005 13:41:54 -0000
@@ -35,15 +35,20 @@
  * $DragonFly: src/games/trek/getpar.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	<stdio.h>
-# include	"getpar.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "getpar.h"
+
+
+static int	testterm(void);
 
 /**
  **	get integer parameter
  **/
 
-getintpar(s)
-char	*s;
+int
+getintpar(const char *s)
 {
 	int	i;
 	int		n;
@@ -60,17 +65,18 @@
 		printf("invalid input; please enter an integer\n");
 		skiptonl(0);
 	}
+	/* NOTREACHED */
 }
 
 /**
  **	get floating parameter
  **/
 
-double getfltpar(s)
-char	*s;
+double 
+getfltpar(const char *s)
 {
-	int		i;
-	double			d;
+	int	i;
+	double	d;
 
 	while (1)
 	{
@@ -84,6 +90,7 @@
 		printf("invalid input; please enter a double\n");
 		skiptonl(0);
 	}
+	/* NOTREACHED */
 }
 
 /**
@@ -92,13 +99,13 @@
 
 struct cvntab	Yntab[] =
 {
-	"y",	"es",	(int (*)())1,	0,
-	"n",	"o",	(int (*)())0,	0,
-	0
+	{"y",	"es",	(void (*)())1,	0},
+	{"n",	"o",	(void (*)())0,	0},
+	{0,	0,	(void (*)())0,	0}
 };
 
-getynpar(s)
-char	*s;
+long
+getynpar(const char *s)
 {
 	struct cvntab		*r;
 
@@ -111,16 +118,15 @@
  **	get coded parameter
  **/
 
-struct cvntab *getcodpar(s, tab)
-char		*s;
-struct cvntab	tab[];
+struct cvntab *
+getcodpar(const char *s, struct cvntab *tab)
 {
-	char				input[100];
-	struct cvntab		*r;
-	int				flag;
-	char			*p, *q;
-	int				c;
-	int				f;
+	char		input[100];
+	struct cvntab	*r;
+	int		flag;
+	const char	*p, *q;
+	int		c;
+	int		f;
 
 	flag = 0;
 	while (1)
@@ -129,7 +135,7 @@
 		if (flag)
 			printf("%s: ", s);
 		if (f)
-			cgetc(0);		/* throw out the newline */
+			getchar();		/* throw out the newline */
 		scanf("%*[ \t;]");
 		if ((c = scanf("%[^ \t;\n]", input)) < 0)
 			exit(1);
@@ -143,7 +149,8 @@
 			c = 4;
 			for (r = tab; r->abrev; r++)
 			{
-				concat(r->abrev, r->full, input);
+				strcpy(input, r->abrev);
+				strcat(input, r->full);
 				printf("%14.14s", input);
 				if (--c > 0)
 					continue;
@@ -181,6 +188,7 @@
 		else
 			return (r);
 	}
+	/* NOTREACHED */
 }
 
 
@@ -188,25 +196,22 @@
  **	get string parameter
  **/
 
-getstrpar(s, r, l, t)
-char	*s;
-char	*r;
-int	l;
-char	*t;
+void
+getstrpar(const char *s, char *r, int l, const char *t)
 {
 	int	i;
-	char		format[20];
+	char	format[20];
 	int	f;
 
 	if (t == 0)
 		t = " \t\n;";
-	(void)sprintf(format, "%%%d[^%s]", l, t);
+	snprintf(format, 20, "%%%d[^%s]", l, t);
 	while (1)
 	{
 		if ((f = testnl()) && s)
 			printf("%s: ", s);
 		if (f)
-			cgetc(0);
+			getchar();
 		scanf("%*[\t ;]");
 		i = scanf(format, r);
 		if (i < 0)
@@ -214,6 +219,7 @@
 		if (i != 0)
 			return;
 	}
+	/* NOTREACHED */
 }
 
 
@@ -221,11 +227,12 @@
  **	test if newline is next valid character
  **/
 
-testnl()
+int
+testnl(void)
 {
-	char		c;
+	char	c;
 
-	while ((c = cgetc(0)) != '\n')
+	while ((c = getchar()) != '\n')
 		if ((c >= '0' && c <= '9') || c == '.' || c == '!' ||
 				(c >= 'A' && c <= 'Z') ||
 				(c >= 'a' && c <= 'z') || c == '-')
@@ -242,11 +249,11 @@
  **	scan for newline
  **/
 
-skiptonl(c)
-char	c;
+void
+skiptonl(char c)
 {
 	while (c != '\n')
-		if (!(c = cgetc(0)))
+		if (!(c = getchar()))
 			return;
 	ungetc('\n', stdin);
 	return;
@@ -257,11 +264,12 @@
  **	test for valid terminator
  **/
 
-testterm()
+int
+testterm(void)
 {
-	char		c;
+	char	c;
 
-	if (!(c = cgetc(0)))
+	if (!(c = getchar()))
 		return (1);
 	if (c == '.')
 		return (0);
@@ -279,12 +287,12 @@
 **	zero is returned.
 */
 
-readdelim(d)
-char	d;
+int
+readdelim(char d)
 {
 	char	c;
 
-	while (c = cgetc(0))
+	while ((c = getchar()))
 	{
 		if (c == d)
 			return (1);
Index: getpar.h
===================================================================
RCS file: /home/dcvs/src/games/trek/getpar.h,v
retrieving revision 1.1
diff -u -r1.1 getpar.h
--- getpar.h	17 Jun 2003 02:49:34 -0000	1.1
+++ getpar.h	31 Mar 2005 20:53:12 -0000
@@ -35,11 +35,19 @@
 
 struct cvntab		/* used for getcodpar() paramater list */
 {
-	char	*abrev;
-	char	*full;
-	int	(*value)();
+	const char *abrev;
+	const char *full;
+	void	(*value)(int);
 	int	value2;
 };
 
-extern double		getfltpar();
-extern struct cvntab	*getcodpar();
+double	getfltpar(const char *);
+struct cvntab *getcodpar(const char *, struct cvntab *);
+int	getintpar(const char *);
+void	getstrpar(const char *, char *, int, const char *);
+long	getynpar(const char *);
+int	readdelim(char);
+void	skiptonl(char);
+int	testnl(void);
+
+int	getcodi(int *, double *);
Index: help.c
===================================================================
RCS file: /home/dcvs/src/games/trek/help.c,v
retrieving revision 1.2
diff -u -r1.2 help.c
--- help.c	17 Jun 2003 04:25:25 -0000	1.2
+++ help.c	28 Mar 2005 15:00:09 -0000
@@ -35,7 +35,9 @@
  * $DragonFly: src/games/trek/help.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <unistd.h>
+#include <math.h>
+#include "trek.h"
 
 /*
 **  call starbase for help
@@ -57,10 +59,11 @@
 **	to drop you.  After that, it's your problem.
 */
 
-char	*Cntvect[3] =
+const char	*Cntvect[3] =
 {"first", "second", "third"};
 
-help()
+void
+help(void)
 {
 	int		i;
 	double			dist, x;
@@ -69,19 +72,29 @@
 
 	/* check to see if calling for help is reasonable ... */
 	if (Ship.cond == DOCKED)
-		return (printf("Uhura: But Captain, we're already docked\n"));
+	{
+		printf("Uhura: But Captain, we're already docked\n");
+		return;
+	}
 
 	/* or possible */
 	if (damaged(SSRADIO))
-		return (out(SSRADIO));
+	{
+		out(SSRADIO);
+		return;
+	}
 	if (Now.bases <= 0)
-		return (printf("Uhura: I'm not getting any response from starbase\n"));
+	{
+		printf("Uhura: I'm not getting any response from starbase\n");
+		return;
+	}
 
 	/* tut tut, there goes the score */
 	Game.helps += 1;
 
 	/* find the closest base */
 	dist = 1e50;
+	l = 0;
 	if (Quad[Ship.quadx][Ship.quady].bases <= 0)
 	{
 		/* there isn't one in this quadrant */
Index: impulse.c
===================================================================
RCS file: /home/dcvs/src/games/trek/impulse.c,v
retrieving revision 1.2
diff -u -r1.2 impulse.c
--- impulse.c	17 Jun 2003 04:25:25 -0000	1.2
+++ impulse.c	28 Mar 2005 15:00:41 -0000
@@ -35,24 +35,31 @@
  * $DragonFly: src/games/trek/impulse.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
+#include "getpar.h"
 
 /**
  **	move under impulse power
  **/
 
-impulse()
+void
+impulse(void)
 {
 	int			course;
 	int		power;
 	double			dist, time;
 	int		percent;
-	extern double		move();
 
 	if (Ship.cond == DOCKED)
-		return (printf("Scotty: Sorry captain, but we are still docked.\n"));
+	{
+		printf("Scotty: Sorry captain, but we are still docked.\n");
+		return;
+	}
 	if (damaged(IMPULSE))
-		return (out(IMPULSE));
+	{
+		out(IMPULSE);
+		return;
+	}
 	if (getcodi(&course, &dist))
 		return;
 	power = 20 + 100 * dist;
Index: initquad.c
===================================================================
RCS file: /home/dcvs/src/games/trek/initquad.c,v
retrieving revision 1.2
diff -u -r1.2 initquad.c
--- initquad.c	17 Jun 2003 04:25:25 -0000	1.2
+++ initquad.c	25 Mar 2005 16:36:07 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/initquad.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  Paramize Quadrant Upon Entering
@@ -54,8 +54,8 @@
 **	to be docked, i.e., abandon() and help().
 */
 
-initquad(f)
-int	f;
+void
+initquad(int f)
 {
 	int		i, j;
 	int			rx, ry;
@@ -136,8 +136,8 @@
 }
 
 
-sector(x, y)
-int	*x, *y;
+void
+sector(int *x, int *y)
 {
 	int		i, j;
 
Index: kill.c
===================================================================
RCS file: /home/dcvs/src/games/trek/kill.c,v
retrieving revision 1.2
diff -u -r1.2 kill.c
--- kill.c	17 Jun 2003 04:25:25 -0000	1.2
+++ kill.c	31 Mar 2005 20:51:10 -0000
@@ -35,7 +35,8 @@
  * $DragonFly: src/games/trek/kill.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <string.h>
+#include "trek.h"
 
 /*
 **  KILL KILL KILL !!!
@@ -53,10 +54,10 @@
 **	and the game is won if that was the last klingon.
 */
 
-killk(ix, iy)
-int	ix, iy;
+void
+killk(int ix, int iy)
 {
-	int		i, j;
+	int		i;
 
 	printf("   *** Klingon at %d,%d destroyed ***\n", ix, iy);
 
@@ -75,7 +76,7 @@
 			/* purge him from the list */
 			Etc.nkling -= 1;
 			for (; i < Etc.nkling; i++)
-				bmove(&Etc.klingon[i+1], &Etc.klingon[i], sizeof Etc.klingon[i]);
+				memmove(&Etc.klingon[i], &Etc.klingon[i+1], sizeof Etc.klingon[i]);
 			break;
 		}
 
@@ -85,7 +86,6 @@
 
 	/* recompute time left */
 	Now.time = Now.resource / Now.klings;
-	return;
 }
 
 
@@ -93,8 +93,8 @@
 **  handle a starbase's death
 */
 
-killb(qx, qy)
-int	qx, qy;
+void
+killb(int qx, int qy)
 {
 	struct quad	*q;
 	struct xy	*b;
@@ -104,18 +104,20 @@
 	if (q->bases <= 0)
 		return;
 	if (!damaged(SSRADIO))
+	{
 		/* then update starchart */
 		if (q->scanned < 1000)
 			q->scanned -= 10;
 		else
 			if (q->scanned > 1000)
 				q->scanned = -1;
+	}
 	q->bases = 0;
 	Now.bases -= 1;
 	for (b = Now.base; ; b++)
 		if (qx == b->x && qy == b->y)
 			break;
-	bmove(&Now.base[Now.bases], b, sizeof *b);
+	memmove(b, &Now.base[Now.bases], sizeof *b);
 	if (qx == Ship.quadx && qy == Ship.quady)
 	{
 		Sect[Etc.starbase.x][Etc.starbase.y] = EMPTY;
@@ -140,14 +142,12 @@
  **	kill an inhabited starsystem
  **/
 
-kills(x, y, f)
-int	x, y;	/* quad coords if f == 0, else sector coords */
-int	f;	/* f != 0 -- this quad;  f < 0 -- Enterprise's fault */
+void
+kills(int x, int y, int f)
 {
 	struct quad	*q;
 	struct event	*e;
-	char		*name;
-	char			*systemname();
+	const char	*name;
 
 	if (f)
 	{
@@ -184,9 +184,8 @@
  **	"kill" a distress call
  **/
 
-killd(x, y, f)
-int	x, y;		/* quadrant coordinates */
-int	f;		/* set if user is to be informed */
+void
+killd(int x, int y, int f)
 {
 	struct event	*e;
 	int		i;
Index: klmove.c
===================================================================
RCS file: /home/dcvs/src/games/trek/klmove.c,v
retrieving revision 1.2
diff -u -r1.2 klmove.c
--- klmove.c	17 Jun 2003 04:25:25 -0000	1.2
+++ klmove.c	31 Mar 2005 20:34:37 -0000
@@ -35,7 +35,8 @@
  * $DragonFly: src/games/trek/klmove.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <string.h>
+#include "trek.h"
 
 /*
 **  Move Klingons Around
@@ -60,8 +61,8 @@
 **	course around stars.
 */
 
-klmove(fl)
-int	fl;
+void
+klmove(int fl)
 {
 	int			n;
 	struct kling	*k;
@@ -74,10 +75,10 @@
 	double			bigger;
 	int			i;
 
-#	ifdef xTRACE
+#ifdef xTRACE
 	if (Trace)
 		printf("klmove: fl = %d, Etc.nkling = %d\n", fl, Etc.nkling);
-#	endif
+#endif
 	for (n = 0; n < Etc.nkling; k && n++)
 	{
 		k = &Etc.klingon[n];
@@ -145,7 +146,7 @@
 				Sect[k->x][k->y] = EMPTY;
 				Quad[qx][qy].klings += 1;
 				Etc.nkling -= 1;
-				bmove(&Etc.klingon[Etc.nkling], k, sizeof *k);
+				memmove(k, &Etc.klingon[Etc.nkling], sizeof *k);
 				Quad[Ship.quadx][Ship.quady].klings -= 1;
 				k = 0;
 				break;
Index: lose.c
===================================================================
RCS file: /home/dcvs/src/games/trek/lose.c,v
retrieving revision 1.2
diff -u -r1.2 lose.c
--- lose.c	17 Jun 2003 04:25:25 -0000	1.2
+++ lose.c	26 Mar 2005 19:00:08 -0000
@@ -35,8 +35,9 @@
  * $DragonFly: src/games/trek/lose.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	<setjmp.h>
+#include <unistd.h>
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  PRINT OUT LOSER MESSAGES
@@ -46,7 +47,7 @@
 **	actions which need be taken are taken.
 */
 
-char	*Losemsg[] =
+const char *Losemsg[] =
 {
 	"You ran out of time",
 	"You ran out of energy",
@@ -63,11 +64,9 @@
 	"Your last crew member died",
 };
 
-lose(why)
-int	why;
+void
+lose(int why)
 {
-	extern jmp_buf	env;
-
 	Game.killed = 1;
 	sleep(1);
 	printf("\n%s\n", Losemsg[why - 1]);
Index: lrscan.c
===================================================================
RCS file: /home/dcvs/src/games/trek/lrscan.c,v
retrieving revision 1.2
diff -u -r1.2 lrscan.c
--- lrscan.c	17 Jun 2003 04:25:25 -0000	1.2
+++ lrscan.c	25 Mar 2005 16:41:54 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/lrscan.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  LONG RANGE OF SCANNERS
@@ -49,7 +49,8 @@
 **	for future use by the "chart" option of the computer.
 */
 
-lrscan()
+void
+lrscan(void)
 {
 	int			i, j;
 	struct quad		*q;
@@ -103,5 +104,4 @@
 		}
 	}
 	printf("\n  -------------------\n");
-	return;
 }
Index: main.c
===================================================================
RCS file: /home/dcvs/src/games/trek/main.c,v
retrieving revision 1.2
diff -u -r1.2 main.c
--- main.c	17 Jun 2003 04:25:25 -0000	1.2
+++ main.c	28 Mar 2005 14:49:15 -0000
@@ -36,15 +36,18 @@
  * $DragonFly: src/games/trek/main.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	<stdio.h>
-# include	<sgtty.h>
-# include	<setjmp.h>
-# include       <stdlib.h>
+#define USE_OLD_TTY
 
-# define	PRIO		00	/* default priority */
+#include <sys/ioctl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "trek.h"
+#include "getpar.h"
 
-int	Mother	= 51 + (51 << 8);
+
+#define	PRIO		00	/* default priority */
+
+unsigned int	Mother	= 51 + (51 << 8);
 
 /*
 **	 ####  #####    #    ####          #####  ####   #####  #   #
@@ -145,9 +148,8 @@
 
 jmp_buf env;
 
-main(argc, argv)
-int	argc;
-char	**argv;
+int
+main(int argc, char **argv)
 {
 	/* extern FILE		*f_log; */
 	char		opencode;
@@ -165,7 +167,7 @@
 	srandomdev();
 	opencode = 'w';
 	prio = PRIO;
-	if (gtty(1, &argp) == 0)
+	if (ioctl(1, TIOCGETP, &argp) != -1)
 	{
 		if ((argp.sg_ispeed ) < B1200)
 			Etc.fast++;
@@ -186,13 +188,13 @@
 			Etc.fast = 0;
 			break;
 
-#		ifdef xTRACE
+#ifdef xTRACE
 		  case 't':	/* trace */
 			if (getuid() != Mother)
 				goto badflag;
 			Trace++;
 			break;
-#		endif
+#endif
 
 		  case 'p':	/* set priority */
 			if (getuid() != Mother)
@@ -229,4 +231,5 @@
 	} while (getynpar("Another game"));
 
 	fflush(stdout);
+	return(0);
 }
Index: move.c
===================================================================
RCS file: /home/dcvs/src/games/trek/move.c,v
retrieving revision 1.2
diff -u -r1.2 move.c
--- move.c	17 Jun 2003 04:25:25 -0000	1.2
+++ move.c	31 Mar 2005 20:52:01 -0000
@@ -35,7 +35,8 @@
  * $DragonFly: src/games/trek/move.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <math.h>
+#include "trek.h"
 
 /*
 **  Move Under Warp or Impulse Power
@@ -72,11 +73,8 @@
 **	Uses trace flag 4.
 */
 
-double move(ramflag, course, time, speed)
-int	ramflag;
-int	course;
-double	time;
-double	speed;
+double 
+move(int ramflag, int course, double time, double speed)
 {
 	double			angle;
 	double			x, y, dx, dy;
@@ -89,11 +87,11 @@
 	double			xn;
 	double			evtime;
 
-#	ifdef xTRACE
+#ifdef xTRACE
 	if (Trace)
 		printf("move: ramflag %d course %d time %.2f speed %.2f\n",
 			ramflag, course, time, speed);
-#	endif
+#endif
 	sectsize = NSECTS;
 	/* initialize delta factors for move */
 	angle = course * 0.0174532925;
@@ -114,13 +112,13 @@
 	/* check for long range tractor beams */
 	/****  TEMPORARY CODE == DEBUGGING  ****/
 	evtime = Now.eventptr[E_LRTB]->date - Now.date;
-#	ifdef xTRACE
+#ifdef xTRACE
 	if (Trace)
 		printf("E.ep = %p, ->evcode = %d, ->date = %.2f, evtime = %.2f\n",
 			(void *)Now.eventptr[E_LRTB],
 			Now.eventptr[E_LRTB]->evcode,
 			Now.eventptr[E_LRTB]->date, evtime);
-#	endif
+#endif
 	if (time > evtime && Etc.nkling < 3)
 	{
 		/* then we got a LRTB */
@@ -137,20 +135,21 @@
 	y = Ship.secty + 0.5;
 	xn = NSECTS * dist * bigger;
 	n = xn + 0.5;
-#	ifdef xTRACE
+#ifdef xTRACE
 	if (Trace)
 		printf("dx = %.2f, dy = %.2f, xn = %.2f, n = %d\n", dx, dy, xn, n);
-#	endif
+#endif
 	Move.free = 0;
 
+	ix = iy = 0;
 	for (i = 0; i < n; i++)
 	{
 		ix = (x += dx);
 		iy = (y += dy);
-#		ifdef xTRACE
+#ifdef xTRACE
 		if (Trace)
 			printf("ix = %d, x = %.2f, iy = %d, y = %.2f\n", ix, x, iy, y);
-#		endif
+#endif
 		if (x < 0.0 || y < 0.0 || x >= sectsize || y >= sectsize)
 		{
 			/* enter new quadrant */
@@ -164,10 +163,10 @@
 				iy = -1;
 			else
 				iy = dy + 0.5;
-#			ifdef xTRACE
+#ifdef xTRACE
 			if (Trace)
 				printf("New quad: ix = %d, iy = %d\n", ix, iy);
-#			endif
+#endif
 			Ship.sectx = x;
 			Ship.secty = y;
 			compkldist(0);
Index: nova.c
===================================================================
RCS file: /home/dcvs/src/games/trek/nova.c,v
retrieving revision 1.2
diff -u -r1.2 nova.c
--- nova.c	17 Jun 2003 04:25:25 -0000	1.2
+++ nova.c	28 Mar 2005 14:45:32 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/nova.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  CAUSE A NOVA TO OCCUR
@@ -51,8 +51,8 @@
 **	If the zap is too much, it gets destroyed.
 */
 
-nova(x, y)
-int	x, y;
+void
+nova(int x, int y)
 {
 	int		i, j;
 	int		se;
@@ -65,7 +65,10 @@
 		return;
 	}
 	if (ranf(100) < 5)
-		return (snova(x, y));
+	{
+		snova(x, y);
+		return;
+	}
 	printf("Spock: Star at %d,%d gone nova\n", x, y);
 
 	if (ranf(4) != 0)
@@ -114,6 +117,7 @@
 			  case QUEENE:
 				se = 2000;
 				if (Ship.shldup)
+				{
 					if (Ship.shield >= se)
 					{
 						Ship.shield -= se;
@@ -124,6 +128,7 @@
 						se -= Ship.shield;
 						Ship.shield = 0;
 					}
+				}
 				Ship.energy -= se;
 				if (Ship.energy <= 0)
 					lose(L_SUICID);
@@ -137,5 +142,4 @@
 			}
 		}
 	}
-	return;
 }
Index: out.c
===================================================================
RCS file: /home/dcvs/src/games/trek/out.c,v
retrieving revision 1.2
diff -u -r1.2 out.c
--- out.c	17 Jun 2003 04:25:25 -0000	1.2
+++ out.c	26 Mar 2005 19:06:52 -0000
@@ -35,20 +35,21 @@
  * $DragonFly: src/games/trek/out.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <string.h>
+#include "trek.h"
 
 /*
 **  Announce Device Out
 */
 
-out(dev)
-int	dev;
+void
+out(int dev)
 {
 	struct device	*d;
 
 	d = &Device[dev];
 	printf("%s reports %s ", d->person, d->name);
-	if (d->name[length(d->name) - 1] == 's')
+	if (d->name[strlen(d->name) - 1] == 's')
 		printf("are");
 	else
 		printf("is");
Index: phaser.c
===================================================================
RCS file: /home/dcvs/src/games/trek/phaser.c,v
retrieving revision 1.2
diff -u -r1.2 phaser.c
--- phaser.c	17 Jun 2003 04:25:25 -0000	1.2
+++ phaser.c	28 Mar 2005agonFly: src/games/trek/phaser.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	"getpar.h"
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
 
 /* factors for phaser hits; see description below */
 
-# define	ALPHA		3.0		/* spread */
-# define	BETA		3.0		/* franf() */
-# define	GAMMA		0.30		/* cos(angle) */
-# define	EPSILON		150.0		/* dist ** 2 */
-# define	OMEGA		10.596		/* overall scaling factor */
+#define	ALPHA		3.0		/* spread */
+#define	BETA		3.0		/* franf() */
+#define	GAMMA		0.30		/* cos(angle) */
+#define	EPSILON		150.0		/* dist ** 2 */
+#define	OMEGA		10.596		/* overall scaling factor */
 
 /* OMEGA ~= 100 * (ALPHA + 1) * (BETA + 1) / (EPSILON + 1) */
 
@@ -73,9 +74,9 @@
 
 struct cvntab	Matab[] =
 {
-	"m",		"anual",		(int (*)())1,		0,
-	"a",		"utomatic",		0,		0,
-	0
+	{"m",	"anual",	(void (*)())1,	0},
+	{"a",	"utomatic",	0,		0},
+	{0,	0,		0,		0}
 };
 
 struct banks
@@ -86,8 +87,8 @@
 };
 
 
-
-phaser()
+void
+phaser(void)
 {
 	int		i;
 	int			j;
@@ -104,11 +105,20 @@
 	struct cvntab		*ptr;
 
 	if (Ship.cond == DOCKED)
-		return(printf("Phasers cannot fire through starbase shields\n"));
+	{
+		printf("Phasers cannot fire through starbase shields\n");
+		return;
+	}
 	if (damaged(PHASER))
-		return (out(PHASER));
+	{
+		out(PHASER);
+		return;
+	}
 	if (Ship.shldup)
-		return (printf("Sulu: Captain, we cannot fire through shields.\n"));
+	{
+		printf("Sulu: Captain, we cannot fire through shields.\n");
+		return;
+	}
 	if (Ship.cloaked)
 	{
 		printf("Sulu: Captain, surely you must realize that we cannot fire\n");
@@ -148,6 +158,7 @@
 	}
 
 	/* initialize the bank[] array */
+	extra = 0;
 	flag = 1;
 	for (i = 0; i < NBANKS; i++)
 		bank[i].units = 0;
@@ -193,7 +204,10 @@
 	{
 		/* automatic distribution of power */
 		if (Etc.nkling <= 0)
-			return (printf("Sulu: But there are no Klingons in this quadrant\n"));
+		{
+			printf("Sulu: But there are no Klingons in this quadrant\n");
+			return;
+		}
 		printf("Phasers locked on target.  ");
 		while (flag)
 		{
@@ -229,14 +243,14 @@
 				b->angle = atan2(dy, dx);
 				b->spread = 0.0;
 				b->units = ((n - i) / tot) * extra;
-#				ifdef xTRACE
+#ifdef xTRACE
 				if (Trace)
 				{
 					printf("b%d hr%d u%d df%.2f af%.2f\n",
 						i, hitreqd[i], b->units,
 						distfactor, anglefactor);
 				}
-#				endif
+#endif
 				extra -= b->units;
 				hit = b->units - hitreqd[i];
 				if (hit > 0)
@@ -270,7 +284,7 @@
 		}
 	}
 
-#	ifdef xTRACE
+#ifdef xTRACE
 	if (Trace)
 	{
 		for (i = 0; i < NBANKS; i++)
@@ -283,7 +297,7 @@
 				printf("\n");
 		}
 	}
-#	endif
+#endif
 
 	/* actually fire the shots */
 	Move.free = 0;
Index: play.c
===================================================================
RCS file: /home/dcvs/src/games/trek/play.c,v
retrieving revision 1.2
diff -u -r1.2 play.c
--- play.c	17 Jun 2003 04:25:25 -0000	1.2
+++ play.c	30 Mar 2005 13:30:35 -0000
@@ -35,9 +35,9 @@
  * $DragonFly: src/games/trek/play.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	"getpar.h"
-# include	<setjmp.h>
+#include "trek.h"
+#include "getpar.h"
+
 
 /*
 **  INSTRUCTION READ AND MAIN PLAY LOOP
@@ -49,47 +49,45 @@
 **	attack if the move was not free, and checkcond() to check up
 **	on how we are doing after the move.
 */
-extern int	abandon(), capture(), shield(), computer(), dcrept(),
-		destruct(), dock(), help(), impulse(), lrscan(),
-		warp(), dumpgame(), rest(), srscan(),
-		myreset(), torped(), visual(), setwarp(), undock(), phaser();
+
+static void	myreset(void);
 
 struct cvntab	Comtab[] =
 {
-	"abandon",		"",			abandon,	0,
-	"ca",			"pture",		capture,	0,
-	"cl",			"oak",			shield,	-1,
-	"c",			"omputer",		computer,	0,
-	"da",			"mages",		dcrept,	0,
-	"destruct",		"",			destruct,	0,
-	"do",			"ck",			dock,		0,
-	"help",			"",			help,		0,
-	"i",			"mpulse",		impulse,	0,
-	"l",			"rscan",		lrscan,	0,
-	"m",			"ove",			warp,		0,
-	"p",			"hasers",		phaser,	0,
-	"ram",			"",			warp,		1,
-	"dump",			"",			dumpgame,	0,
-	"r",			"est",			rest,		0,
-	"sh",			"ield",			shield,	0,
-	"s",			"rscan",		srscan,	0,
-	"st",			"atus",			srscan,	-1,
-	"terminate",		"",			myreset,	0,
-	"t",			"orpedo",		torped,	0,
-	"u",			"ndock",		undock,	0,
-	"v",			"isual",		visual,	0,
-	"w",			"arp",			setwarp,	0,
-	0
+	{"abandon",		"",		(void (*)(int))abandon,	0},
+	{"ca",			"pture",	(void (*)(int))capture,	0},
+	{"cl",			"oak",		(void (*)(int))shield,	-1},
+	{"c",			"omputer",	(void (*)(int))computer,0},
+	{"da",			"mages",	(void (*)(int))dcrept,	0},
+	{"destruct",		"",		(void (*)(int))destruct,0},
+	{"do",			"ck",		(void (*)(int))dock,	0},
+	{"help",		"",		(void (*)(int))help,	0},
+	{"i",			"mpulse",	(void (*)(int))impulse,	0},
+	{"l",			"rscan",	(void (*)(int))lrscan,	0},
+	{"m",			"ove",		(void (*)(int))warp,	0},
+	{"p",			"hasers",	(void (*)(int))phaser,	0},
+	{"ram",			"",		(void (*)(int))warp,	1},
+	{"dump",		"",		(void (*)(int))dumpgame,0},
+	{"r",			"est",		(void (*)(int))rest,	0},
+	{"sh",			"ield",		(void (*)(int))shield,	0},
+	{"s",			"rscan",	(void (*)(int))srscan,	0},
+	{"st",			"atus",		(void (*)(int))srscan,	-1},
+	{"terminate",		"",		(void (*)(int))myreset,	0},
+	{"t",			"orpedo",	(void (*)(int))torped,	0},
+	{"u",			"ndock",	(void (*)(int))undock,	0},
+	{"v",			"isual",	(void (*)(int))visual,	0},
+	{"w",			"arp",		(void (*)(int))setwarp,	0},
+	{0,			0,		(void (*)(int))0,	0}
 };
 
-myreset()
+void
+myreset(void)
 {
-	extern jmp_buf env;
-
 	longjmp(env, 1);
 }
 
-play()
+void
+play(void)
 {
 	struct cvntab		*r;
 
Index: ram.c
===================================================================
RCS file: /home/dcvs/src/games/trek/ram.c,v
retrieving revision 1.2
diff -u -r1.2 ram.c
--- ram.c	17 Jun 2003 04:25:25 -0000	1.2
+++ ram.c	26 Mar 2005 19:00:22 -0000
@@ -35,7 +35,8 @@
  * $DragonFly: src/games/trek/ram.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <unistd.h>
+#include "trek.h"
 
 /*
 **  RAM SOME OBJECT
@@ -48,8 +49,8 @@
 **	also rack up incredible damages.
 */
 
-ram(ix, iy)
-int	ix, iy;
+void
+ram(int ix, int iy)
 {
 	int		i;
 	char		c;
Index: ranf.c
===================================================================
RCS file: /home/dcvs/src/games/trek/ranf.c,v
retrieving revision 1.2
diff -u -r1.2 ranf.c
--- ranf.c	17 Jun 2003 04:25:25 -0000	1.2
+++ ranf.c	26 Mar 2005 19:05:12 -0000
@@ -35,11 +35,11 @@
  * $DragonFly: src/games/trek/ranf.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	<stdio.h>
-# include       <stdlib.h>
+#include <stdlib.h>
+#include "trek.h"
 
-ranf(max)
-int	max;
+int
+ranf(int max)
 {
 	if (max <= 0)
 		return (0);
@@ -47,7 +47,8 @@
 }
 
 
-double franf()
+double 
+franf(void)
 {
 	double		t;
 	t = random() & 077777;
Index: rest.c
===================================================================
RCS file: /home/dcvs/src/games/trek/rest.c,v
retrieving revision 1.2
diff -u -r1.2 rest.c
--- rest.c	17 Jun 2003 04:25:25 -0000	1.2
+++ rest.c	25 Mar 2005 16:51:24 -0000
@@ -35,8 +35,8 @@
  * $DragonFly: src/games/trek/rest.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	"getpar.h"
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  REST FOR REPAIRS
@@ -52,7 +52,8 @@
 **	rest period if anything momentous happens.
 */
 
-rest()
+void
+rest(void)
 {
 	double			t;
 	int		percent;
Index: schedule.c
===================================================================
RCS file: /home/dcvs/src/games/trek/schedule.c,v
retrieving revision 1.2
diff -u -r1.2 schedule.c
--- schedule.c	17 Jun 2003 04:25:25 -0000	1.2
+++ schedule.c	28 Mar 2005 14:28:01 -0000
@@ -35,7 +35,8 @@
  * $DragonFly: src/games/trek/schedule.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <math.h>
+#include "trek.h"
 
 /*
 **  SCHEDULE AN EVENT
@@ -47,11 +48,8 @@
 **	The address of the slot is returned.
 */
 
-struct event *schedule(type, offset, x, y, z)
-int	type;
-double	offset;
-char	x, y;
-char	z;
+struct event *
+schedule(int type, double offset, char x, char y, char z)
 {
 	struct event	*e;
 	int		i;
@@ -64,11 +62,11 @@
 		if (e->evcode)
 			continue;
 		/* got a slot */
-#		ifdef xTRACE
+#ifdef xTRACE
 		if (Trace)
 			printf("schedule: type %d @ %.2f slot %d parm %d %d %d\n",
 				type, date, i, x, y, z);
-#		endif
+#endif
 		e->evcode = type;
 		e->date = date;
 		e->x = x;
@@ -78,6 +76,7 @@
 		return (e);
 	}
 	syserr("Cannot schedule event %d parm %d %d %d", type, x, y, z);
+	return NULL;
 }
 
 
@@ -88,9 +87,8 @@
 **	time plus 'offset'.
 */
 
-reschedule(e1, offset)
-struct event	*e1;
-double		offset;
+void
+reschedule(struct event *e1, double offset)
 {
 	double			date;
 	struct event	*e;
@@ -99,12 +97,11 @@
 
 	date = Now.date + offset;
 	e->date = date;
-#	ifdef xTRACE
+#ifdef xTRACE
 	if (Trace)
 		printf("reschedule: type %d parm %d %d %d @ %.2f\n",
 			e->evcode, e->x, e->y, e->systemname, date);
-#	endif
-	return;
+#endif
 }
 
 
@@ -114,22 +111,21 @@
 **	The event at slot 'e' is deleted.
 */
 
-unschedule(e1)
-struct event	*e1;
+void
+unschedule(struct event *e1)
 {
 	struct event	*e;
 
 	e = e1;
 
-#	ifdef xTRACE
+#ifdef xTRACE
 	if (Trace)
 		printf("unschedule: type %d @ %.2f parm %d %d %d\n",
 			e->evcode, e->date, e->x, e->y, e->systemname);
-#	endif
+#endif
 	Now.eventptr[e->evcode & E_EVENT] = 0;
 	e->date = 1e50;
 	e->evcode = 0;
-	return;
 }
 
 
@@ -140,10 +136,8 @@
 **	figure.
 */
 
-struct event *xsched(ev1, factor, x, y, z)
-int	ev1;
-int	factor;
-int	x, y, z;
+struct event *
+xsched(int ev1, int factor, int x, int y, int z)
 {
 	int	ev;
 
@@ -159,10 +153,8 @@
 **	division factor.  Look at the code to see what really happens.
 */
 
-xresched(e1, ev1, factor)
-struct event	*e1;
-int		ev1;
-int		factor;
+void
+xresched(struct event *e1, int ev1, int factor)
 {
 	int		ev;
 	struct event	*e;
Index: score.c
===================================================================
RCS file: /home/dcvs/src/games/trek/score.c,v
retrieving revision 1.2
diff -u -r1.2 score.c
--- score.c	17 Jun 2003 04:25:25 -0000	1.2
+++ score.c	26 Mar 2005 18:42:26 -0000
@@ -35,20 +35,20 @@
  * $DragonFly: src/games/trek/score.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	"getpar.h"
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  PRINT OUT THE CURRENT SCORE
 */
 
-long score()
+long 
+score(void)
 {
 	int		u;
 	int		t;
 	long			s;
 	double			r;
-	extern struct cvntab	Skitab[];
 
 	printf("\n*** Your score:\n");
 	s = t = Param.klingpwr / 4 * (u = Game.killk);
Index: setup.c
===================================================================
RCS file: /home/dcvs/src/games/trek/setup.c,v
retrieving revision 1.2
diff -u -r1.2 setup.c
--- setup.c	17 Jun 2003 04:25:25 -0000	1.2
+++ setup.c	26 Mar 2005 19:07:40 -0000
@@ -35,9 +35,11 @@
  * $DragonFly: src/games/trek/setup.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include       <stdlib.h>
-# include	"trek.h"
-# include	"getpar.h"
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  INITIALIZE THE GAME
@@ -52,31 +54,31 @@
 
 struct cvntab	Lentab[] =
 {
-	"s",		"hort",			(int (*)())1,		0,
-	"m",		"edium",		(int (*)())2,		0,
-	"l",		"ong",			(int (*)())4,		0,
-	"restart",	"",			0,		0,
-	0
+	{"s",		"hort",		(void (*)())1,	0},
+	{"m",		"edium",	(void (*)())2,	0},
+	{"l",		"ong",		(void (*)())4,	0},
+	{"restart",	"",		0,		0},
+	{0,		0,		0,		0}
 };
 
 struct cvntab	Skitab[] =
 {
-	"n",		"ovice",		(int (*)())1,		0,
-	"f",		"air",			(int (*)())2,		0,
-	"g",		"ood",			(int (*)())3,		0,
-	"e",		"xpert",		(int (*)())4,		0,
-	"c",		"ommodore",		(int (*)())5,		0,
-	"i",		"mpossible",		(int (*)())6,		0,
-	0
+	{"n",		"ovice",	(void (*)())1,	0},
+	{"f",		"air",		(void (*)())2,	0},
+	{"g",		"ood",		(void (*)())3,	0},
+	{"e",		"xpert",	(void (*)())4,	0},
+	{"c",		"ommodore",	(void (*)())5,	0},
+	{"i",		"mpossible",	(void (*)())6,	0},
+	{0,		0,		0,		0}
 };
 
-setup()
+void
+setup(void)
 {
 	struct cvntab		*r;
 	int		i, j;
 	double			f;
 	int			d;
-	int			fd;
 	int			klump;
 	int			ix, iy;
 	struct quad	*q;
@@ -98,7 +100,7 @@
 	Game.skill = (long) r->value;
 	Game.tourn = 0;
 	getstrpar("Enter a password", Game.passwd, 14, 0);
-	if (sequal(Game.passwd, "tournament"))
+	if (strcmp(Game.passwd, "tournament") == 0)
 	{
 		getstrpar("Enter tournament code", Game.passwd, 14, 0);
 		Game.tourn = 1;
Index: setwarp.c
===================================================================
RCS file: /home/dcvs/src/games/trek/setwarp.c,v
retrieving revision 1.2
diff -u -r1.2 setwarp.c
--- setwarp.c	17 Jun 2003 04:25:25 -0000	1.2
+++ setwarp.c	28 Mar 2005 14:41:59 -0000
@@ -35,8 +35,8 @@
  * $DragonFly: src/games/trek/setwarp.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	"getpar.h"
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  SET WARP FACTOR
@@ -45,7 +45,8 @@
 **	checked for consistancy.
 */
 
-setwarp()
+void
+setwarp(void)
 {
 	double	warpfac;
 
@@ -53,9 +54,15 @@
 	if (warpfac < 0.0)
 		return;
 	if (warpfac < 1.0)
-		return (printf("Minimum warp speed is 1.0\n"));
+	{
+		printf("Minimum warp speed is 1.0\n");
+		return;
+	}
 	if (warpfac > 10.0)
-		return (printf("Maximum speed is warp 10.0\n"));
+	{
+		printf("Maximum speed is warp 10.0\n");
+		return;
+	}
 	if (warpfac > 6.0)
 		printf("Damage to warp engines may occur above warp 6.0\n");
 	Ship.warp = warpfac;
Index: shield.c
===================================================================
RCS file: /home/dcvs/src/games/trek/shield.c,v
retrieving revision 1.2
diff -u -r1.2 shield.c
--- shield.c	17 Jun 2003 04:25:25 -0000	1.2
+++ shield.c	28 Mar 2005 14:40:50 -0000
@@ -35,8 +35,8 @@
  * $DragonFly: src/games/trek/shield.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	"getpar.h"
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  SHIELD AND CLOAKING DEVICE CONTROL
@@ -57,19 +57,18 @@
 
 struct cvntab Udtab[] =
 {
-	"u",		"p",			(int (*)())1,		0,
-	"d",		"own",			0,		0,
-	0
+	{"u",	"p",	(void (*)())1,	0},
+	{"d",	"own",	0,		0},
+	{0,	0,	0,		0}
 };
 
-shield(f)
-int	f;
+void
+shield(int f)
 {
 	int		i;
-	char			c;
 	struct cvntab		*r;
 	char			s[100];
-	char			*device, *dev2, *dev3;
+	const char		*device, *dev2, *dev3;
 	int			ind;
 	char			*stat;
 
@@ -79,7 +78,10 @@
 	{
 		/* cloaking device */
 		if (Ship.ship == QUEENE)
-			return (printf("Ye Faire Queene does not have the cloaking device.\n"));
+		{
+			printf("Ye Faire Queene does not have the cloaking device.\n");
+			return;
+		}
 		device = "Cloaking device";
 		dev2 = "is";
 		ind = CLOAK;
@@ -114,9 +116,9 @@
 	else
 	{
 		if (*stat)
-			(void)sprintf(s, "%s %s up.  Do you want %s down", device, dev2, dev3);
+			snprintf(s, 100, "%s %s up.  Do you want %s down", device, dev2, dev3);
 		else
-			(void)sprintf(s, "%s %s down.  Do you want %s up", device, dev2, dev3);
+			snprintf(s, 100, "%s %s down.  Do you want %s up", device, dev2, dev3);
 		if (!getynpar(s))
 			return;
 		i = !*stat;
@@ -131,13 +133,14 @@
 		return;
 	}
 	if (i)
+	{	
 		if (f >= 0)
 			Ship.energy -= Param.shupengy;
 		else
 			Ship.cloakgood = 0;
+	}
 	Move.free = 0;
 	if (f >= 0)
 		Move.shldchg = 1;
 	*stat = i;
-	return;
 }
Index: snova.c
===================================================================
RCS file: /home/dcvs/src/games/trek/snova.c,v
retrieving revision 1.2
diff -u -r1.2 snova.c
--- snova.c	17 Jun 2003 04:25:25 -0000	1.2
+++ snova.c	26 Mar 2005 19:00:34 -0000
@@ -35,7 +35,8 @@
  * $DragonFly: src/games/trek/snova.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <unistd.h>
+#include "trek.h"
 
 /*
 **  CAUSE SUPERNOVA TO OCCUR
@@ -58,8 +59,8 @@
 **	override mode.
 */
 
-snova(x, y)
-int	x, y;
+void
+snova(int x, int y)
 {
 	int			qx, qy;
 	int		ix, iy;
@@ -70,6 +71,7 @@
 
 	f = 0;
 	ix = x;
+	iy = y;
 	if (ix < 0)
 	{
 		/* choose a quadrant */
@@ -100,7 +102,6 @@
 	else
 	{
 		/* current quadrant */
-		iy = y;
 		qx = Ship.quadx;
 		qy = Ship.quady;
 		q = &Quad[qx][qy];
@@ -140,12 +141,12 @@
 		/* Enterprise caused supernova */
 		Game.kills += dy;
 		if (q->bases)
-			killb(qx, qy, -1);
+			killb(qx, qy);
 		Game.killk += dx;
 	}
 	else
 		if (q->bases)
-			killb(qx, qy, 0);
+			killb(qx, qy);
 	killd(qx, qy, (x >= 0));
 	q->stars = -1;
 	q->klings = 0;
@@ -154,5 +155,4 @@
 		printf("Lucky devil, that supernova destroyed the last klingon\n");
 		win();
 	}
-	return;
 }
Index: srscan.c
===================================================================
RCS file: /home/dcvs/src/games/trek/srscan.c,v
retrieving revision 1.2
diff -u -r1.2 srscan.c
--- srscan.c	17 Jun 2003 04:25:25 -0000	1.2
+++ srscan.c	28 Mar 2005 14:27:00 -0000
@@ -35,8 +35,8 @@
  * $DragonFly: src/games/trek/srscan.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	"getpar.h"
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  SHORT RANGE SENSOR SCAN
@@ -53,7 +53,7 @@
 **	The current quadrant is filled in on the computer chart.
 */
 
-char	*Color[4] =
+const char *Color[4] =
 {
 	"GREEN",
 	"DOCKED",
@@ -61,16 +61,14 @@
 	"RED"
 };
 
-srscan(f)
-int	f;
+void
+srscan(int f)
 {
 	int		i, j;
 	int		statinfo;
-	char			*s;
+	const char		*s;
 	int			percent;
 	struct quad		*q;
-	extern struct cvntab	Skitab[];
-	extern struct cvntab	Lentab[];
 	struct cvntab		*p;
 
 	if (f >= 0 && check_out(SRSCAN))
@@ -91,10 +89,11 @@
 		if (!Etc.fast)
 			return;
 	}
+	
+	q = &Quad[Ship.quadx][Ship.quady];
 	if (f >= 0)
 	{
 		printf("\nShort range sensor scan\n");
-		q = &Quad[Ship.quadx][Ship.quady];
 		q->scanned = q->klings * 100 + q->bases * 10 + q->stars;
 		printf("  ");
 		for (i = 0; i < NSECTS; i++)
Index: systemname.c
===================================================================
RCS file: /home/dcvs/src/games/trek/systemname.c,v
retrieving revision 1.2
diff -u -r1.2 systemname.c
--- systemname.c	17 Jun 2003 04:25:25 -0000	1.2
+++ systemname.c	28 Mar 2005 14:40:08 -0000
@@ -35,7 +35,7 @@
  * $DragonFly: src/games/trek/systemname.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
 
 /*
 **  RETRIEVE THE STARSYSTEM NAME
@@ -48,8 +48,8 @@
 **	starsystems, etc.
 */
 
-char *systemname(q1)
-struct quad	*q1;
+const char *
+systemname(struct quad *q1)
 {
 	struct quad	*q;
 	int		i;
Index: torped.c
===================================================================
RCS file: /home/dcvs/src/games/trek/torped.c,v
retrieving revision 1.2
diff -u -r1.2 torped.c
--- torped.c	17 Jun 2003 04:25:25 -0000	1.2
+++ torped.c	26 Mar 2005 19:05:52 -0000
@@ -35,8 +35,12 @@
  * $DragonFly: src/games/trek/torped.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	<stdio.h>
-# include	"trek.h"
+#include <stdlib.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
+
+static int randcourse(int n);
 
 /*
 **  PHOTON TORPEDO CONTROL
@@ -57,8 +61,8 @@
 **	the misfire damages your torpedo tubes.
 */
 
-
-torped()
+void
+torped(void)
 {
 	int		ix, iy;
 	double			x, y, dx, dy;
@@ -72,13 +76,15 @@
 
 	if (Ship.cloaked)
 	{
-		return (printf("Federation regulations do not permit attack while cloaked.\n"));
+		printf("Federation regulations do not permit attack while cloaked.\n");
+		return;
 	}
 	if (check_out(TORPED))
 		return;
 	if (Ship.torped <= 0)
 	{
-		return (printf("All photon torpedos expended\n"));
+		printf("All photon torpedos expended\n");
+		return;
 	}
 
 	/* get the course */
@@ -98,7 +104,7 @@
 		/* see if the user wants one */
 		if (!testnl())
 		{
-			k = ungetc(cgetc(0), stdin);
+			k = ungetc(getchar(), stdin);
 			if (k >= '0' && k <= '9')
 				burst = 1;
 		}
@@ -113,7 +119,10 @@
 		if (burst <= 0)
 			return;
 		if (burst > 15)
-			return (printf("Maximum burst angle is 15 degrees\n"));
+		{
+			printf("Maximum burst angle is 15 degrees\n");
+			return;
+		}
 	}
 	sectsize = NSECTS;
 	n = -1;
@@ -215,8 +224,8 @@
 **	to the tubes, etc.
 */
 
-randcourse(n)
-int	n;
+int
+randcourse(int n)
 {
 	double			r;
 	int		d;
Index: trek.h
===================================================================
RCS file: /home/dcvs/src/games/trek/trek.h,v
retrieving revision 1.1
diff -u -r1.1 trek.h
--- trek.h	17 Jun 2003 02:49:36 -0000	1.1
+++ trek.h	31 Mar 2005 20:52:31 -0000
@@ -51,22 +51,15 @@
 **	actually allocate stuff in "externs.c"
 */
 
-/* external function definitions */
-extern double	franf();	/* floating random number function */
-extern double	sqrt();		/* square root */
-extern double	sin(), cos();	/* trig functions */
-extern double	atan2();	/* fancy arc tangent function */
-extern double	log();		/* log base e */
-extern double	pow();		/* power function */
-extern double	fabs();		/* absolute value function */
-extern double	exp();		/* exponential function */
+#include <stdio.h>
+#include <setjmp.h>
 
 /*********************  GALAXY  **************************/
 
 /* galactic parameters */
-# define	NSECTS		10	/* dimensions of quadrant in sectors */
-# define	NQUADS		8	/* dimension of galazy in quadrants */
-# define	NINHAB		32	/* number of quadrants which are inhabited */
+#define	NSECTS		10	/* dimensions of quadrant in sectors */
+#define	NQUADS		8	/* dimension of galazy in quadrants */
+#define	NINHAB		32	/* number of quadrants which are inhabited */
 
 struct quad		/* definition for each quadrant */
 {
@@ -78,8 +71,8 @@
 	char	qsystemname;	/* starsystem name (see below) */
 };
 
-# define	Q_DISTRESSED	0200
-# define	Q_SYSTEM	077
+#define	Q_DISTRESSED	0200
+#define	Q_SYSTEM	077
 
 /*  systemname conventions:
  *	1 -> NINHAB	index into Systemname table for live system.
@@ -96,20 +89,20 @@
 */
 
 /* ascii names of systems */
-extern char	*Systemname[NINHAB];
+extern const char	*Systemname[NINHAB];
 
 /* quadrant definition */
 struct quad	Quad[NQUADS][NQUADS];
 
 /* defines for sector map  (below) */
-# define	EMPTY		'.'
-# define	STAR		'*'
-# define	BASE		'#'
-# define	ENTERPRISE	'E'
-# define	QUEENE		'Q'
-# define	KLINGON		'K'
-# define	INHABIT		'@'
-# define	HOLE		' '
+#define	EMPTY		'.'
+#define	STAR		'*'
+#define	BASE		'#'
+#define	ENTERPRISE	'E'
+#define	QUEENE		'Q'
+#define	KLINGON		'K'
+#define	INHABIT		'@'
+#define	HOLE		' '
 
 /* current sector map */
 char	Sect[NSECTS][NSECTS];
@@ -117,58 +110,58 @@
 
 /************************ DEVICES ******************************/
 
-# define	NDEV		16	/* max number of devices */
+#define	NDEV		16	/* max number of devices */
 
 /* device tokens */
-# define	WARP		0	/* warp engines */
-# define	SRSCAN		1	/* short range scanners */
-# define	LRSCAN		2	/* long range scanners */
-# define	PHASER		3	/* phaser control */
-# define	TORPED		4	/* photon torpedo control */
-# define	IMPULSE		5	/* impulse engines */
-# define	SHIELD		6	/* shield control */
-# define	COMPUTER	7	/* on board computer */
-# define	SSRADIO		8	/* subspace radio */
-# define	LIFESUP		9	/* life support systems */
-# define	SINS		10	/* Space Inertial Navigation System */
-# define	CLOAK		11	/* cloaking device */
-# define	XPORTER		12	/* transporter */
-# define	SHUTTLE		13	/* shuttlecraft */
+#define	WARP		0	/* warp engines */
+#define	SRSCAN		1	/* short range scanners */
+#define	LRSCAN		2	/* long range scanners */
+#define	PHASER		3	/* phaser control */
+#define	TORPED		4	/* photon torpedo control */
+#define	IMPULSE		5	/* impulse engines */
+#define	SHIELD		6	/* shield control */
+#define	COMPUTER	7	/* on board computer */
+#define	SSRADIO		8	/* subspace radio */
+#define	LIFESUP		9	/* life support systems */
+#define	SINS		10	/* Space Inertial Navigation System */
+#define	CLOAK		11	/* cloaking device */
+#define	XPORTER		12	/* transporter */
+#define	SHUTTLE		13	/* shuttlecraft */
 
 /* device names */
 struct device
 {
-	char	*name;		/* device name */
-	char	*person;	/* the person who fixes it */
+	const char	*name;		/* device name */
+	const char	*person;	/* the person who fixes it */
 };
 
-struct device	Device[NDEV];
+extern struct device	Device[NDEV];
 
 /***************************  EVENTS  ****************************/
 
-# define	NEVENTS		12	/* number of different event types */
+#define	NEVENTS		12	/* number of different event types */
 
-# define	E_LRTB		1	/* long range tractor beam */
-# define	E_KATSB		2	/* Klingon attacks starbase */
-# define	E_KDESB		3	/* Klingon destroys starbase */
-# define	E_ISSUE		4	/* distress call is issued */
-# define	E_ENSLV		5	/* Klingons enslave a quadrant */
-# define	E_REPRO		6	/* a Klingon is reproduced */
-# define	E_FIXDV		7	/* fix a device */
-# define	E_ATTACK	8	/* Klingon attack during rest period */
-# define	E_SNAP		9	/* take a snapshot for time warp */
-# define	E_SNOVA		10	/* supernova occurs */
-
-# define	E_GHOST		0100	/* ghost of a distress call if ssradio out */
-# define	E_HIDDEN	0200	/* event that is unreportable because ssradio out */
-# define	E_EVENT		077	/* mask to get event code */
+#define	E_LRTB		1	/* long range tractor beam */
+#define	E_KATSB		2	/* Klingon attacks starbase */
+#define	E_KDESB		3	/* Klingon destroys starbase */
+#define	E_ISSUE		4	/* distress call is issued */
+#define	E_ENSLV		5	/* Klingons enslave a quadrant */
+#define	E_REPRO		6	/* a Klingon is reproduced */
+#define	E_FIXDV		7	/* fix a device */
+#define	E_ATTACK	8	/* Klingon attack during rest period */
+#define	E_SNAP		9	/* take a snapshot for time warp */
+#define	E_SNOVA		10	/* supernova occurs */
+
+#define	E_GHOST		0100	/* ghost of a distress call if ssradio out */
+#define	E_HIDDEN	0200	/* event that is unreportable because ssradio out */
+#define	E_EVENT		077	/* mask to get event code */
 
 struct event
 {
-	char	x, y;			/* coordinates */
+	int	x, y;			/* coordinates */
 	double	date;			/* trap stardate */
 	char	evcode;			/* event type */
-	char	systemname;		/* starsystem name */
+	int	systemname;		/* starsystem name */
 };
 /* systemname conventions:
  *	1 -> NINHAB	index into Systemname table for reported distress calls
@@ -180,7 +173,7 @@
  *	0		unallocated
  */
 
-# define	MAXEVENTS	25	/* max number of concurrently pending events */
+#define	MAXEVENTS	25	/* max number of concurrently pending events */
 
 struct event	Event[MAXEVENTS];	/* dynamic event list; one entry per pending event */
 
@@ -188,35 +181,35 @@
 
 struct kling
 {
-	char	x, y;		/* coordinates */
+	unsigned char x, y;	/* coordinates */
 	int	power;		/* power left */
 	double	dist;		/* distance to Enterprise */
 	double	avgdist;	/* average over this move */
 	char	srndreq;	/* set if surrender has been requested */
 };
 
-# define	MAXKLQUAD	9	/* maximum klingons per quadrant */
+#define	MAXKLQUAD	9	/* maximum klingons per quadrant */
 
 /********************** MISCELLANEOUS ***************************/
 
 /* condition codes */
-# define	GREEN		0
-# define	DOCKED		1
-# define	YELLOW		2
-# define	RED		3
+#define	GREEN		0
+#define	DOCKED		1
+#define	YELLOW		2
+#define	RED		3
 
 /* starbase coordinates */
-# define	MAXBASES	9	/* maximum number of starbases in galaxy */
+#define	MAXBASES	9	/* maximum number of starbases in galaxy */
 
 /*  distress calls  */
-# define	MAXDISTR	5	/* maximum concurrent distress calls */
+#define	MAXDISTR	5	/* maximum concurrent distress calls */
 
 /* phaser banks */
-# define	NBANKS		6	/* number of phaser banks */
+#define	NBANKS		6	/* number of phaser banks */
 
 struct xy
 {
-	char	x, y;		/* coordinates */
+	unsigned char	x, y;	/* coordinates */
 };
 
 
@@ -245,9 +238,9 @@
 	int	quady;		/* quadrant y coord */
 	int	sectx;		/* sector x coord */
 	int	secty;		/* sector y coord */
-	char	cond;		/* condition code */
+	unsigned char cond;	/* condition code */
 	char	sinsbad;	/* Space Inertial Navigation System condition */
-	char	*shipname;	/* name of current starship */
+	const char *shipname;	/* name of current starship */
 	char	ship;		/* current starship */
 	int	distressed;	/* number of distress calls */
 }	Ship;
@@ -323,7 +316,7 @@
 /* other information kept in a snapshot */
 struct
 {
-	char	bases;		/* number of starbases */
+	unsigned char bases;	/* number of starbases */
 	char	klings;		/* number of klingons */
 	double	date;		/* stardate */
 	double	time;		/* time left */
@@ -337,7 +330,7 @@
 struct
 {
 	struct kling	klingon[MAXKLQUAD];	/* sorted Klingon list */
-	char		nkling;			/* number of Klingons in this sector */
+	int		nkling;			/* number of Klingons in this sector */
 						/* < 0 means automatic override mode */
 	char		fast;			/* set if speed > 300 baud */
 	struct xy	starbase;	/* starbase in current quadrant */
@@ -351,32 +344,91 @@
  */
 
 /* Klingon move indicies */
-# define	KM_OB		0	/* Old quadrant, Before attack */
-# define	KM_OA		1	/* Old quadrant, After attack */
-# define	KM_EB		2	/* Enter quadrant, Before attack */
-# define	KM_EA		3	/* Enter quadrant, After attack */
-# define	KM_LB		4	/* Leave quadrant, Before attack */
-# define	KM_LA		5	/* Leave quadrant, After attack */
+#define	KM_OB		0	/* Old quadrant, Before attack */
+#define	KM_OA		1	/* Old quadrant, After attack */
+#define	KM_EB		2	/* Enter quadrant, Before attack */
+#define	KM_EA		3	/* Enter quadrant, After attack */
+#define	KM_LB		4	/* Leave quadrant, Before attack */
+#define	KM_LA		5	/* Leave quadrant, After attack */
 
 /* you lose codes */
-# define	L_NOTIME	1	/* ran out of time */
-# define	L_NOENGY	2	/* ran out of energy */
-# define	L_DSTRYD	3	/* destroyed by a Klingon */
-# define	L_NEGENB	4	/* ran into the negative energy barrier */
-# define	L_SUICID	5	/* destroyed in a nova */
-# define	L_SNOVA		6	/* destroyed in a supernova */
-# define	L_NOLIFE	7	/* life support died (so did you) */
-# define	L_NOHELP	8	/* you could not be rematerialized */
-# define	L_TOOFAST	9	/* pretty stupid going at warp 10 */
-# define	L_STAR		10	/* ran into a star */
-# define	L_DSTRCT	11	/* self destructed */
-# define	L_CAPTURED	12	/* captured by Klingons */
-# define	L_NOCREW	13	/* you ran out of crew */
+#define	L_NOTIME	1	/* ran out of time */
+#define	L_NOENGY	2	/* ran out of energy */
+#define	L_DSTRYD	3	/* destroyed by a Klingon */
+#define	L_NEGENB	4	/* ran into the negative energy barrier */
+#define	L_SUICID	5	/* destroyed in a nova */
+#define	L_SNOVA		6	/* destroyed in a supernova */
+#define	L_NOLIFE	7	/* life support died (so did you) */
+#define	L_NOHELP	8	/* you could not be rematerialized */
+#define	L_TOOFAST	9	/* pretty stupid going at warp 10 */
+#define	L_STAR		10	/* ran into a star */
+#define	L_DSTRCT	11	/* self destructed */
+#define	L_CAPTURED	12	/* captured by Klingons */
+#define	L_NOCREW	13	/* you ran out of crew */
 
 /******************  COMPILE OPTIONS  ***********************/
 
 /* Trace info */
-# define	xTRACE		1
+#define	xTRACE		1
 int	Trace;
 
-extern char	*systemname();
+extern jmp_buf 		env;
+extern struct cvntab	Skitab[];
+extern struct cvntab	Lentab[];
+
+void	abandon(void);
+void	attack(int);
+void	autover(void);
+void	capture(void);
+int	check_out(int);
+void	checkcond(void);
+void	compkldist(int);
+void	computer(void);
+void	damage(int, double);
+int	damaged(int);
+void	dcrept(void);
+void	destruct(void);
+void	dock(void);
+void	dumpgame(void);
+void	dumpme(int);
+int	dumpssradio(void);
+int	events(int);
+double	franf(void);
+void	help(void);
+void	impulse(void);
+void	initquad(int);
+void	killk(int, int);
+void	killb(int, int);
+void	kills(int, int, int);
+void	killd(int, int, int);
+void	klmove(int);
+void	lose(int);
+void	lrscan(void);
+double	move(int, int, double, double);
+void	nova(int, int);
+void	out(int);
+void	phaser(void);
+void	play(void);
+void	ram(int, int);
+int	ranf(int);
+void	reschedule(struct event *, double);
+void	rest(void);
+int	restartgame(void);
+struct event *schedule(int, double, char, char, char);
+long	score(void);
+void	sector(int *, int *);
+void	setup(void);
+void	setwarp(void);
+void	shield(int);
+void	snova(int, int);
+void	srscan(int);
+void	syserr(const char *, ...);
+const char *systemname(struct quad *);
+void	torped(void);
+void	undock(void);
+void	unschedule(struct event *);
+void	visual(void);
+void	warp(int, int, double);
+void	win(void);
+void	xresched(struct event *, int, int);
+struct event *xsched(int, int, int, int, int);
Index: utility.c
===================================================================
RCS file: /home/dcvs/src/games/trek/utility.c,v
retrieving revision 1.2
diff -u -r1.2 utility.c
--- utility.c	17 Jun 2003 04:25:25 -0000	1.2
+++ utility.c	31 Mar 2005 20:29:19 -0000
@@ -35,116 +35,27 @@
  * $DragonFly: src/games/trek/utility.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-/*
-**  ASSORTED UTILITY ROUTINES
-*/
-
-/*
-**  BLOCK MOVE
-**
-**	Moves a block of storage of length `l' bytes from the data
-**	area pointed to by `a' to the area pointed to by `b'.
-**	Returns the address of the byte following the `b' field.
-**	Overflow of `b' is not tested.
-*/
-
-char *bmove(a, b, l)
-char	*a, *b;
-int	l;
-{
-	int		n;
-	char		*p, *q;
-
-	p = a;
-	q = b;
-	n = l;
-	while (n--)
-		*q++ = *p++;
-	return (q);
-}
-
-
-/*
-**  STRING EQUALITY TEST
-**	null-terminated strings `a' and `b' are tested for
-**	absolute equality.
-**	returns one if equal, zero otherwise.
-*/
-
-sequal(a, b)
-char	*a, *b;
-{
-	char		*p, *q;
-
-	p = a;
-	q = b;
-	while (*p || *q)
-		if (*p++ != *q++)
-			return(0);
-	return(1);
-}
-
-
-/*
-**  STRING CONCATENATE
-**
-**	The strings `s1' and `s2' are concatenated and stored into
-**	`s3'.  It is ok for `s1' to equal `s3', but terrible things
-**	will happen if `s2' equals `s3'.  The return value is is a
-**	pointer to the end of `s3' field.
-*/
-
-char *concat(s1, s2, s3)
-char	*s1, *s2, *s3;
-{
-	char		*p;
-	char		*q;
-
-	p = s3;
-	q = s1;
-	while (*q)
-		*p++ = *q++;
-	q = s2;
-	while (*q)
-		*p++ = *q++;
-	*p = 0;
-	return (p);
-}
-
-
-/*
-**  FIND STRING LENGTH
-**
-**	The length of string `s' (excluding the null byte which
-**		terminates the string) is returned.
-*/
-
-length(s)
-char	*s;
-{
-	int	l;
-	char	*p;
-
-	l = 0;
-	p = s;
-	while (*p++)
-		l++;
-	return(l);
-}
+#include <stdlib.h>
+#include <stdarg.h>
+#include <errno.h>
+#include "trek.h"
 
 
 /*
 **  SYSTEM ERROR
 */
 
-syserr(p0, p1, p2, p3, p4, p5)
+void
+syserr(const char *fmt, ...)
 {
-	extern int	errno;
+	va_list	va;
 
+	va_start(va, fmt);
 	printf("\n\07TREK SYSERR: ");
-	printf(p0, p1, p2, p3, p4, p5);
+	vprintf(fmt, va);
 	printf("\n");
 	if (errno)
 		printf("\tsystem error %d\n", errno);
+	va_end(va);
 	exit(1);
 }
Index: visual.c
===================================================================
RCS file: /home/dcvs/src/games/trek/visual.c,v
retrieving revision 1.2
diff -u -r1.2 visual.c
--- visual.c	17 Jun 2003 04:25:25 -0000	1.2
+++ visual.c	26 Mar 2005 18:26:38 -0000
@@ -35,7 +35,8 @@
  * $DragonFly: src/games/trek/visual.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  VISUAL SCAN
@@ -49,20 +50,21 @@
 /* This struct[] has the delta x, delta y for particular directions */
 struct xy	Visdelta[11] =
 {
-	-1,	-1,
-	-1,	 0,
-	-1,	 1,
-	 0,	 1,
-	 1,	 1,
-	 1,	 0,
-	 1,	-1,
-	 0,	-1,
-	-1,	-1,
-	-1,	 0,
-	-1,	 1
+	{-1,	-1},
+	{-1,	 0},
+	{-1,	 1},
+	{ 0,	 1},
+	{ 1,	 1},
+	{ 1,	 0},
+	{ 1,	-1},
+	{ 0,	-1},
+	{-1,	-1},
+	{-1,	 0},
+	{-1,	 1}
 };
 
-visual()
+void
+visual(void)
 {
 	int		ix, iy;
 	int			co;
Index: warp.c
===================================================================
RCS file: /home/dcvs/src/games/trek/warp.c,v
retrieving revision 1.2
diff -u -r1.2 warp.c
--- warp.c	17 Jun 2003 04:25:25 -0000	1.2
+++ warp.c	31 Mar 2005 20:53:40 -0000
@@ -35,7 +35,10 @@
  * $DragonFly: src/games/trek/warp.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
+#include <unistd.h>
+#include <string.h>
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  MOVE UNDER WARP POWER
@@ -53,9 +56,8 @@
 **	case, there is code to handle time warps, etc.
 */
 
-warp(fl, c, d)
-int	fl, c;
-double	d;
+void
+warp(int fl, int c, double d)
 {
 	int			course;
 	double			power;
@@ -65,13 +67,17 @@
 	double			frac;
 	int		percent;
 	int		i;
-	extern double		move();
+	char		*p;
 
 	if (Ship.cond == DOCKED)
-		return (printf("%s is docked\n", Ship.shipname));
+	{
+		printf("%s is docked\n", Ship.shipname);
+		return;
+	}
 	if (damaged(WARP))
 	{
-		return (out(WARP));
+		out(WARP);
+		return;
 	}
 	if (fl < 0)
 	{
@@ -134,7 +140,8 @@
 	sleep(4);
 	if (ranf(100) >= 100 * dist)
 	{
-		return (printf("Equilibrium restored -- all systems normal\n"));
+		printf("Equilibrium restored -- all systems normal\n");
+		return;
 	}
 
 	/* select a bizzare thing to happen to us */
@@ -160,10 +167,10 @@
 
 		/* s/he got lucky: a negative time portal */
 		time = Now.date;
-		i = (int) Etc.snapshot;
-		bmove(i, Quad, sizeof Quad);
-		bmove(i += sizeof Quad, Event, sizeof Event);
-		bmove(i += sizeof Event, &Now, sizeof Now);
+		p = Etc.snapshot;
+		memmove(Quad, p, sizeof(Quad));
+		memmove(Event, p += sizeof(Quad), sizeof(Event));
+		memmove(&Now, p += sizeof(Event), sizeof(Now));
 		printf("Negative time portal entered -- it is now Stardate %.2f\n",
 			Now.date);
 		for (i = 0; i < MAXEVENTS; i++)
Index: win.c
===================================================================
RCS file: /home/dcvs/src/games/trek/win.c,v
retrieving revision 1.2
diff -u -r1.2 win.c
--- win.c	17 Jun 2003 04:25:25 -0000	1.2
+++ win.c	26 Mar 2005 19:01:00 -0000
@@ -35,9 +35,9 @@
  * $DragonFly: src/games/trek/win.c,v 1.2 2003/06/17 04:25:25 dillon Exp $
  */
 
-# include	"trek.h"
-# include	"getpar.h"
-# include	<setjmp.h>
+#include <unistd.h>
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  Signal game won
@@ -52,12 +52,11 @@
 **	pretty off the wall.
 */
 
-win()
+void
+win(void)
 {
-	long			s;
-	extern jmp_buf		env;
-	extern long		score();
-	extern struct cvntab	Skitab[];
+	long		s;
+
 	struct cvntab	*p;
 
 	sleep(1);


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]