From 8b785b5296c388fda5f56b0916bb69797d01049e Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 31 May 2024 20:41:33 -0400 Subject: unprotbas: warnings for overly-long files. --- unprotbas.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'unprotbas.c') 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"); -- cgit v1.2.3