diff options
-rw-r--r-- | unprotbas.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/unprotbas.c b/unprotbas.c index c1c0e68..a179a0c 100644 --- a/unprotbas.c +++ b/unprotbas.c @@ -235,14 +235,17 @@ int fixcode(void) { if(verbose) fprintf(stderr, "End program pos $%04x/%d\n", pos, pos); if(filelen > pos) { - int i, nonzero = 0; - for(i = pos; i < filelen; i++) - if(data[i]) nonzero = 1; + int i, same = 1; + for(i = pos; i < filelen; i++) { + if(data[i] != data[pos]) same = 0; + } if(verbose) { - fprintf(stderr, "trailing garbage at EOF, %d bytes, %s, %s\n", - filelen - pos, - nonzero ? "maybe valid data" : "all zeroes", - (keepgarbage ? "keeping" : "removing")); + fprintf(stderr, "trailing garbage at EOF, %d bytes, ", filelen - pos); + if(same) + fprintf(stderr, "all $%02x", data[pos]); + else + fprintf(stderr, "maybe valid data"); + fprintf(stderr, ", %s\n", (keepgarbage ? "keeping" : "removing")); } if(!keepgarbage) filelen = pos; } |