diff options
author | B. Watson <urchlay@slackware.uk> | 2024-05-29 16:09:37 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-05-29 16:09:37 -0400 |
commit | 7558a8d9bda4e474baf1b625640a5868652a5bcb (patch) | |
tree | 0ac2e2fb8481180227ee52c621a132b4b37aef8f | |
parent | abdafc3fdf75b92a7a46eac6e0747f9a536a0447 (diff) | |
download | bw-atari8-tools-7558a8d9bda4e474baf1b625640a5868652a5bcb.tar.gz |
unprotbas: with -v, show whether trailing garbage is all zeroes.
-rw-r--r-- | unprotbas.c | 12 |
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; } |