diff options
| author | B. Watson <urchlay@slackware.uk> | 2025-11-14 17:03:36 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2025-11-14 17:03:36 -0500 |
| commit | c6c54622b219a25cbbd24665c2394056ac33b8b4 (patch) | |
| tree | b6535c3fcff5d404633c7a338591032561931584 /src/extract.c | |
| parent | d94681f507e624eebbcffa218882e6cd73ca9784 (diff) | |
| download | unalf-c6c54622b219a25cbbd24665c2394056ac33b8b4.tar.gz | |
Exit status 2 for bad checksums, print report with -t.
Diffstat (limited to 'src/extract.c')
| -rw-r--r-- | src/extract.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/extract.c b/src/extract.c index 31559cf..9c45941 100644 --- a/src/extract.c +++ b/src/extract.c @@ -7,6 +7,7 @@ #include "unalf.h" #include "addrs.h" +int bad_checksum, bad_checksum_count = 0; char *out_filename; void dpoke(int addr, u16 value) { @@ -87,15 +88,27 @@ void extract_alf(void) { out_filename = realname; } + bad_checksum = 0; uncrunch_file(); + if(bad_checksum) bad_checksum_count++; if(!opts.extract_to_stdout) fclose(out_file); out_filename = 0; } + + if(opts.testonly && !opts.quiet) { + if(bad_checksum_count) + printf("%d file%s with bad checksum!\n", + bad_checksum_count, + bad_checksum_count == 1 ? "" : "s"); + else + printf("All files OK.\n"); + } } static void chksum_err(void) { - fprintf(stderr, "%s: checksum error on file %s\n", self, out_filename); + bad_checksum = 1; + fprintf(stderr, "%s: checksum error on %s\n", self, out_filename); } void uncrunch_file(void) { |
