summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>1999-09-10 00:18:20 +0000
committerjsm <jsm@NetBSD.org>1999-09-10 00:18:20 +0000
commitb9e9a125627944dbfaacf50922e58f4900e9c567 (patch)
treea8357b35169078e664f1e5fd90266ef0a0e662d0
parent517497ea9683bb0c3bb9a38d4b7930b325c9db03 (diff)
downloadbsdgames-darwin-b9e9a125627944dbfaacf50922e58f4900e9c567.tar.gz
bsdgames-darwin-b9e9a125627944dbfaacf50922e58f4900e9c567.tar.zst
bsdgames-darwin-b9e9a125627944dbfaacf50922e58f4900e9c567.zip
Check for write errors in auxiliary programs used during build of games.
-rw-r--r--boggle/mkdict/mkdict.c8
-rw-r--r--boggle/mkindex/mkindex.c8
-rw-r--r--fortune/strfile/strfile.c7
-rw-r--r--monop/initdeck.c13
4 files changed, 24 insertions, 12 deletions
diff --git a/boggle/mkdict/mkdict.c b/boggle/mkdict/mkdict.c
index 0b4e6644..e96bc5b9 100644
--- a/boggle/mkdict/mkdict.c
+++ b/boggle/mkdict/mkdict.c
@@ -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);
}
diff --git a/boggle/mkindex/mkindex.c b/boggle/mkindex/mkindex.c
index b93096c2..53610aa4 100644
--- a/boggle/mkindex/mkindex.c
+++ b/boggle/mkindex/mkindex.c
@@ -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);
}
diff --git a/fortune/strfile/strfile.c b/fortune/strfile/strfile.c
index 0d74f4e2..5c8954e1 100644
--- a/fortune/strfile/strfile.c
+++ b/fortune/strfile/strfile.c
@@ -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);
}
diff --git a/monop/initdeck.c b/monop/initdeck.c
index a4b76b3e..9e5cd9b7 100644
--- a/monop/initdeck.c
+++ b/monop/initdeck.c
@@ -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);