X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/7a7d157b6dfb2274277e61ea5f1c8a97e88e73ba..2c9d660d25b79e9638f82eac75697f7a0e85a085:/adventure/save.c?ds=inline diff --git a/adventure/save.c b/adventure/save.c index 8eed7e14..2f0e355b 100644 --- a/adventure/save.c +++ b/adventure/save.c @@ -1,4 +1,4 @@ -/* $NetBSD: save.c,v 1.4 1997/10/11 01:53:33 lukem Exp $ */ +/* $NetBSD: save.c,v 1.8 2003/08/07 09:36:51 agc Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -17,11 +17,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -43,10 +39,11 @@ #if 0 static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: save.c,v 1.4 1997/10/11 01:53:33 lukem Exp $"); +__RCSID("$NetBSD: save.c,v 1.8 2003/08/07 09:36:51 agc Exp $"); #endif #endif /* not lint */ +#include #include #include #include "hdr.h" @@ -95,7 +92,7 @@ struct savestruct save_array[] = {&oldlc2, sizeof(oldlc2)}, {&oldloc, sizeof(oldloc)}, {&panic, sizeof(panic)}, - {&saved, sizeof(saved)}, + {&saveday, sizeof(saveday)}, {&savet, sizeof(savet)}, {&scorng, sizeof(scorng)}, {&spk, sizeof(spk)}, @@ -126,7 +123,7 @@ struct savestruct save_array[] = int save(outfile) /* Two passes on data: first to get checksum, * second */ - char *outfile; /* to output the data using checksum to start + const char *outfile; /* to output the data using checksum to start * random #s */ { FILE *out; @@ -152,13 +149,16 @@ save(outfile) /* Two passes on data: first to get checksum, *s = (*s ^ random()) & 0xFF; /* Lightly encrypt */ fwrite(p->address, p->width, 1, out); } - fclose(out); + if (fclose(out) != 0) { + warn("writing %s", outfile); + return 1; + } return 0; } int restore(infile) - char *infile; + const char *infile; { FILE *in; struct savestruct *p;