From 304b13a6e742a713bfd576bbfd3a39aa2ed2f323 Mon Sep 17 00:00:00 2001
From: "B. Watson" <urchlay@slackware.uk>
Date: Tue, 9 Jul 2024 20:07:22 -0400
Subject: bas.c: null out input_file and output_file when closed (so caller can
 know they're closed).

---
 bas.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bas.c b/bas.c
index 7c7fa34..cf73fef 100644
--- a/bas.c
+++ b/bas.c
@@ -71,6 +71,7 @@ void readfile(void) {
 	else if(filelen > MAX_PROG_SIZE)
 		fprintf(stderr, "Warning: file is %d bytes, suspiciously large for a BASIC program.\n", filelen);
 	fclose(input_file);
+	input_file = NULL; /* so caller can tell it's closed */
 	if(filelen < MIN_PROG_SIZE)
 		die("File too short to be a BASIC program (truncated?)\n");
 }
@@ -80,6 +81,7 @@ int writefile(void) {
 
 	outbytes = fwrite(program, 1, filelen, output_file);
 	fclose(output_file);
+	output_file = NULL; /* so caller can tell it's closed */
 	if(verbose) fprintf(stderr, "Wrote %d bytes.\n", outbytes);
 	return outbytes;
 }
-- 
cgit v1.2.3