summaryrefslogtreecommitdiffstats
path: root/trek/setup.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1997-10-12 21:24:24 +0000
committerchristos <christos@NetBSD.org>1997-10-12 21:24:24 +0000
commit634cb6ceab3191623a3daed5e953821e3f37a4cb (patch)
tree2bb707d4d2f4e28a241cac2e70f7392be0acb329 /trek/setup.c
parenta77b3f8edc13dc6efdbcf80e336689cfa1de08ab (diff)
downloadbsdgames-darwin-634cb6ceab3191623a3daed5e953821e3f37a4cb.tar.gz
bsdgames-darwin-634cb6ceab3191623a3daed5e953821e3f37a4cb.tar.zst
bsdgames-darwin-634cb6ceab3191623a3daed5e953821e3f37a4cb.zip
Warnsify and remove local implementations of libc functions.
Diffstat (limited to 'trek/setup.c')
-rw-r--r--trek/setup.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/trek/setup.c b/trek/setup.c
index ce752026..6e381be5 100644
--- a/trek/setup.c
+++ b/trek/setup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.4 1995/04/24 12:26:06 cgd Exp $ */
+/* $NetBSD: setup.c,v 1.5 1997/10/12 21:25:15 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -33,16 +33,22 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: setup.c,v 1.4 1995/04/24 12:26:06 cgd Exp $";
+__RCSID("$NetBSD: setup.c,v 1.5 1997/10/12 21:25:15 christos Exp $");
#endif
#endif /* not lint */
-# include "trek.h"
-# include "getpar.h"
+#include <stdio.h>
+#include <math.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <err.h>
+#include "trek.h"
+#include "getpar.h"
/*
** INITIALIZE THE GAME
@@ -57,34 +63,34 @@ static char rcsid[] = "$NetBSD: setup.c,v 1.4 1995/04/24 12:26:06 cgd Exp $";
struct cvntab Lentab[] =
{
- "s", "hort", (int (*)())1, 0,
- "m", "edium", (int (*)())2, 0,
- "l", "ong", (int (*)())4, 0,
- "restart", "", 0, 0,
- 0
+ { "s", "hort", (cmdfun)1, 0 },
+ { "m", "edium", (cmdfun)2, 0 },
+ { "l", "ong", (cmdfun)4, 0 },
+ { "restart", "", (cmdfun)0, 0 },
+ { NULL, NULL, NULL, 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", (cmdfun)1, 0 },
+ { "f", "air", (cmdfun)2, 0 },
+ { "g", "ood", (cmdfun)3, 0 },
+ { "e", "xpert", (cmdfun)4, 0 },
+ { "c", "ommodore", (cmdfun)5, 0 },
+ { "i", "mpossible", (cmdfun)6, 0 },
+ { NULL, NULL, NULL, 0 }
};
+void
setup()
{
struct cvntab *r;
- register int i, j;
+ int i, j;
double f;
int d;
- int fd;
int klump;
int ix, iy;
- register struct quad *q;
+ struct quad *q;
struct event *e;
while (1)
@@ -103,7 +109,7 @@ setup()
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;
@@ -165,7 +171,7 @@ setup()
for (i = j = 0; i < NDEV; i++)
j += Param.damprob[i];
if (j != 1000)
- syserr("Device probabilities sum to %d", j);
+ errx(1, "Device probabilities sum to %d", j);
Param.dockfac = 0.5;
Param.regenfac = (5 - Game.skill) * 0.05;
if (Param.regenfac < 0.0)