aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-09 20:07:22 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-09 20:07:22 -0400
commit304b13a6e742a713bfd576bbfd3a39aa2ed2f323 (patch)
tree8389e4b10c47eed6a8435e9c79e7a3e9d9243aaa
parent1cb5ede65dc47d142b65722ce9c24fe76268a440 (diff)
downloadbw-atari8-tools-304b13a6e742a713bfd576bbfd3a39aa2ed2f323.tar.gz
bas.c: null out input_file and output_file when closed (so caller can know they're closed).
-rw-r--r--bas.c2
1 files changed, 2 insertions, 0 deletions
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;
}