Check for write errors in auxiliary programs used during build of games.
This commit is contained in:
parent
68603a9d0e
commit
18c51c04de
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mkdict.c,v 1.3 1997/10/11 02:12:21 lukem Exp $ */
|
||||
/* $NetBSD: mkdict.c,v 1.4 1999/09/10 00:18:20 jsm Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
|
@ -46,7 +46,7 @@ static char copyright[] =
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mkdict.c 8.1 (Berkeley) 6/11/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: mkdict.c,v 1.3 1997/10/11 02:12:21 lukem Exp $";
|
||||
static char rcsid[] = "$NetBSD: mkdict.c,v 1.4 1999/09/10 00:18:20 jsm Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -62,6 +62,7 @@ static char rcsid[] = "$NetBSD: mkdict.c,v 1.3 1997/10/11 02:12:21 lukem Exp $";
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
#include "bog.h"
|
||||
|
||||
|
@ -125,5 +126,8 @@ main(argc, argv)
|
|||
current = !current;
|
||||
}
|
||||
warnx("%d words", nwords);
|
||||
fflush(stdout);
|
||||
if (ferror(stdout))
|
||||
err(1, "writing standard output");
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mkindex.c,v 1.4 1998/09/11 13:16:05 hubertf Exp $ */
|
||||
/* $NetBSD: mkindex.c,v 1.5 1999/09/10 00:18:21 jsm Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
|
@ -46,10 +46,11 @@ static char copyright[] =
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mkindex.c 8.1 (Berkeley) 6/11/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: mkindex.c,v 1.4 1998/09/11 13:16:05 hubertf Exp $";
|
||||
static char rcsid[] = "$NetBSD: mkindex.c,v 1.5 1999/09/10 00:18:21 jsm Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bog.h"
|
||||
|
@ -75,6 +76,9 @@ main(void)
|
|||
off += clen + 1;
|
||||
}
|
||||
printf("%c %6ld %6ld\n", prev, start, off - 1);
|
||||
fflush(stdout);
|
||||
if (ferror(stdout))
|
||||
err(1, "writing standard output");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: strfile.c,v 1.12 1999/09/09 17:30:19 jsm Exp $ */
|
||||
/* $NetBSD: strfile.c,v 1.13 1999/09/10 00:18:21 jsm Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)strfile.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: strfile.c,v 1.12 1999/09/09 17:30:19 jsm Exp $");
|
||||
__RCSID("$NetBSD: strfile.c,v 1.13 1999/09/10 00:18:21 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -256,6 +256,9 @@ main(ac, av)
|
|||
HTOBE64(*p);
|
||||
(void) fwrite((char *) Seekpts, sizeof *Seekpts, (int) Num_pts, outf);
|
||||
}
|
||||
fflush(outf);
|
||||
if (ferror(outf))
|
||||
err(1, "fwrite %s", Outfile);
|
||||
(void) fclose(outf);
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: initdeck.c,v 1.10 1999/09/09 17:27:59 jsm Exp $ */
|
||||
/* $NetBSD: initdeck.c,v 1.11 1999/09/10 00:18:21 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
|
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)initdeck.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: initdeck.c,v 1.10 1999/09/09 17:27:59 jsm Exp $");
|
||||
__RCSID("$NetBSD: initdeck.c,v 1.11 1999/09/10 00:18:21 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -105,10 +105,8 @@ main(ac, av)
|
|||
if (CC_D.offsets == NULL || CH_D.offsets == NULL)
|
||||
errx(1, "out of memory");
|
||||
fseek(inf, 0L, SEEK_SET);
|
||||
if ((outf = fopen(outfile, "w")) == NULL) {
|
||||
perror(outfile);
|
||||
exit(0);
|
||||
}
|
||||
if ((outf = fopen(outfile, "w")) == NULL)
|
||||
err(1, "fopen %s", outfile);
|
||||
|
||||
/*
|
||||
* these fields will be overwritten after the offsets are calculated,
|
||||
|
@ -143,6 +141,9 @@ main(ac, av)
|
|||
fwrite(CC_D.offsets, sizeof (off_t), CC_D.num_cards, outf);
|
||||
fwrite(CH_D.offsets, sizeof (off_t), CH_D.num_cards, outf);
|
||||
|
||||
fflush(outf);
|
||||
if (ferror(outf))
|
||||
err(1, "fwrite %s", outfile);
|
||||
fclose(outf);
|
||||
printf("There were %d com. chest and %d chance cards\n",
|
||||
CC_D.num_cards, CH_D.num_cards);
|
||||
|
|
Loading…
Reference in New Issue