diff options
author | christos <christos@NetBSD.org> | 1997-10-12 21:24:24 +0000 |
---|---|---|
committer | christos <christos@NetBSD.org> | 1997-10-12 21:24:24 +0000 |
commit | 634cb6ceab3191623a3daed5e953821e3f37a4cb (patch) | |
tree | 2bb707d4d2f4e28a241cac2e70f7392be0acb329 /trek/dumpgame.c | |
parent | a77b3f8edc13dc6efdbcf80e336689cfa1de08ab (diff) | |
download | bsdgames-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/dumpgame.c')
-rw-r--r-- | trek/dumpgame.c | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/trek/dumpgame.c b/trek/dumpgame.c index 17e7e7a1..2dbd9a28 100644 --- a/trek/dumpgame.c +++ b/trek/dumpgame.c @@ -1,4 +1,4 @@ -/* $NetBSD: dumpgame.c,v 1.4 1995/04/24 12:25:54 cgd Exp $ */ +/* $NetBSD: dumpgame.c,v 1.5 1997/10/12 21:24:42 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -33,15 +33,20 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dumpgame.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: dumpgame.c,v 1.4 1995/04/24 12:25:54 cgd Exp $"; +__RCSID("$NetBSD: dumpgame.c,v 1.5 1997/10/12 21:24:42 christos Exp $"); #endif #endif /* not lint */ -# include "trek.h" +#include <stdio.h> +#include <err.h> +#include <unistd.h> +#include <fcntl.h> +#include "trek.h" /*** THIS CONSTANT MUST CHANGE AS THE DATA SPACES CHANGE ***/ # define VERSION 2 @@ -52,19 +57,21 @@ struct dump int count; }; +static int readdump __P((int)); + 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) }, + { NULL, 0 } }; /* @@ -77,15 +84,20 @@ struct dump Dump_template[] = ** output change. */ -dumpgame() +/*ARGSUSED*/ +void +dumpgame(v) + int v; { - int version; - register int fd; - register struct dump *d; - register int i; + int version; + int fd; + struct dump *d; + int i; - if ((fd = creat("trek.dump", 0644)) < 0) - return (printf("cannot dump\n")); + if ((fd = creat("trek.dump", 0644)) < 0) { + warn("cannot open `trek.dump'"); + return; + } version = VERSION; write(fd, &version, sizeof version); @@ -112,9 +124,10 @@ dumpgame() ** Return value is zero for success, one for failure. */ +int restartgame() { - register int fd; + int fd; int version; if ((fd = open("trek.dump", 0)) < 0 || @@ -141,12 +154,13 @@ restartgame() ** Returns zero for success, one for failure. */ +static int readdump(fd1) int fd1; { - register int fd; - register struct dump *d; - register int i; + int fd; + struct dump *d; + int i; long junk; fd = fd1; |