From ed884b9fa4509c09f0f7ab71efe57a4e83a2e055 Mon Sep 17 00:00:00 2001 From: Paul Janzen Date: Wed, 19 Aug 1998 07:42:28 +0000 Subject: tags, formatting, ANSI-fication, prototypes, de-typos, and the occasional initialization, removal of unused variable, or other minor fix. Most changes are from or inspired by NetBSD. --- games/trek/dumpgame.c | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'games/trek/dumpgame.c') diff --git a/games/trek/dumpgame.c b/games/trek/dumpgame.c index 17e7e7a19eb..c8344f31506 100644 --- a/games/trek/dumpgame.c +++ b/games/trek/dumpgame.c @@ -1,3 +1,4 @@ +/* $OpenBSD: dumpgame.c,v 1.2 1998/08/19 07:41:29 pjanzen Exp $ */ /* $NetBSD: dumpgame.c,v 1.4 1995/04/24 12:25:54 cgd Exp $ */ /* @@ -37,11 +38,15 @@ #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 $"; +static char rcsid[] = "$OpenBSD: dumpgame.c,v 1.2 1998/08/19 07:41:29 pjanzen Exp $"; #endif #endif /* not lint */ -# include "trek.h" +#include +#include +#include +#include +#include "trek.h" /*** THIS CONSTANT MUST CHANGE AS THE DATA SPACES CHANGE ***/ # define VERSION 2 @@ -55,18 +60,20 @@ struct dump 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 } }; +static int readdump __P((int)); + /* ** DUMP GAME ** @@ -77,7 +84,9 @@ struct dump Dump_template[] = ** output change. */ -dumpgame() +void +dumpgame(v) + int v; { int version; register int fd; @@ -85,7 +94,10 @@ dumpgame() register int i; if ((fd = creat("trek.dump", 0644)) < 0) - return (printf("cannot dump\n")); + { + warn("cannot open `trek.dump'"); + return; + } version = VERSION; write(fd, &version, sizeof version); @@ -112,6 +124,7 @@ dumpgame() ** Return value is zero for success, one for failure. */ +int restartgame() { register int fd; @@ -141,8 +154,9 @@ restartgame() ** Returns zero for success, one for failure. */ +static int readdump(fd1) -int fd1; + int fd1; { register int fd; register struct dump *d; -- cgit v1.2.3