aboutsummaryrefslogtreecommitdiff
path: root/listamsb.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-02-28 00:23:01 -0500
committerB. Watson <urchlay@slackware.uk>2025-02-28 00:23:01 -0500
commit4b4fc033f654f41306b66b36e0f95f9fb152b6c5 (patch)
tree2c2f0ea20fa51489af04b70cb011e65dc3e49a1f /listamsb.c
parente35eb15b4f56cb9db815ffe8761bb8053e61c49b (diff)
downloadbw-atari8-tools-4b4fc033f654f41306b66b36e0f95f9fb152b6c5.tar.gz
listamsb: improve program size mismatch warning, pluralize warning(s) correctly.
Diffstat (limited to 'listamsb.c')
-rw-r--r--listamsb.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/listamsb.c b/listamsb.c
index 2c1a438..eda6d9d 100644
--- a/listamsb.c
+++ b/listamsb.c
@@ -102,6 +102,8 @@ void die_with(const char *msg, int status) {
/* post-processing: print "summary", exit. called by either read_byte()
(on 'unexpected EOF'), or main() (on normal exit). */
void finish(int rv, const char *msg) {
+ int progsize;
+
if(msg) fprintf(stderr, "%s: %s\n", self, msg);
if(verbose) {
@@ -114,12 +116,21 @@ void finish(int rv, const char *msg) {
warnings++;
}
- if(proglen == (bytes_read - 3)) {
+ progsize = bytes_read - 3;
+ if(proglen == progsize) {
if(verbose)
fprintf(stderr, "file size matches proglen\n");
} else {
- fprintf(stderr, "%s: actual program size doesn't match program size in header\n", self);
warnings++;
+ fprintf(stderr, "%s: actual program size %d "
+ "doesn't match program size %d in header,\n"
+ " ",
+ self, progsize, proglen);
+ if(proglen > progsize) {
+ fprintf(stderr, "AMSB will give #136 ERROR and fail to LOAD this file\n");
+ } else {
+ fprintf(stderr, "AMSB will stop LOADing before the end of this file\n");
+ }
}
if(fgetc(infile) != EOF) {
@@ -128,7 +139,8 @@ void finish(int rv, const char *msg) {
}
if(warnings) {
- fprintf(stderr, "%s: file has %d warnings\n", self, warnings);
+ fprintf(stderr, "%s: file has %d warning%s\n",
+ self, warnings, (warnings == 1 ? "" : "s"));
rv = 2;
}