aboutsummaryrefslogtreecommitdiff
path: root/unprotbas.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-05-29 16:09:37 -0400
committerB. Watson <urchlay@slackware.uk>2024-05-29 16:09:37 -0400
commit7558a8d9bda4e474baf1b625640a5868652a5bcb (patch)
tree0ac2e2fb8481180227ee52c621a132b4b37aef8f /unprotbas.c
parentabdafc3fdf75b92a7a46eac6e0747f9a536a0447 (diff)
downloadbw-atari8-tools-7558a8d9bda4e474baf1b625640a5868652a5bcb.tar.gz
unprotbas: with -v, show whether trailing garbage is all zeroes.
Diffstat (limited to 'unprotbas.c')
-rw-r--r--unprotbas.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/unprotbas.c b/unprotbas.c
index bf1fb7e..6dd263c 100644
--- a/unprotbas.c
+++ b/unprotbas.c
@@ -235,11 +235,17 @@ int fixcode(void) {
if(verbose) fprintf(stderr, "End program pos $%04x/%d\n", pos, pos);
if(filelen > pos) {
- if(verbose) fprintf(stderr, "trailing garbage at EOF, %d bytes, %s\n",
- filelen - pos, (keepgarbage ? "keeping" : "removing"));
+ int i, nonzero = 0;
+ for(i = pos; i < filelen; i++)
+ if(data[i]) nonzero = 1;
+ if(verbose) {
+ fprintf(stderr, "trailing garbage at EOF, %d bytes, %s, %s\n",
+ filelen - pos,
+ nonzero ? "maybe valid data" : "all zeroes",
+ (keepgarbage ? "keeping" : "removing"));
+ }
if(!keepgarbage) filelen = pos;
}
-
return result;
}