diff options
author | B. Watson <urchlay@slackware.uk> | 2024-05-31 20:41:33 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-05-31 20:41:33 -0400 |
commit | 8b785b5296c388fda5f56b0916bb69797d01049e (patch) | |
tree | 25d684af0fcc94fb1ebaefdadd2239ff43223d3e | |
parent | e65f9eed531f1618f92cecfef5103e407022a69a (diff) | |
download | bw-atari8-tools-8b785b5296c388fda5f56b0916bb69797d01049e.tar.gz |
unprotbas: warnings for overly-long files.
-rw-r--r-- | unprotbas.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/unprotbas.c b/unprotbas.c index d7ca847..a4a2129 100644 --- a/unprotbas.c +++ b/unprotbas.c @@ -113,6 +113,10 @@ void die(const char *msg) { int readfile(void) { int got = fread(data, 1, BUFSIZE - 1, input_file); if(verbose) fprintf(stderr, "Read %d bytes.\n", got); + if(!feof(input_file)) + fprintf(stderr, "Warning: file is >64KB, way too big for a BASIC program.\n"); + else if(got > 38176) + fprintf(stderr, "Warning: file is %d bytes, suspiciously large for a BASIC program.\n", got); fclose(input_file); if(got < MIN_PROG_SIZE) die("File too short to be a BASIC program (truncated?)\n"); |