diff options
Diffstat (limited to 'src/listalf.c')
| -rw-r--r-- | src/listalf.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/src/listalf.c b/src/listalf.c index 051f2fe..71d8195 100644 --- a/src/listalf.c +++ b/src/listalf.c @@ -77,30 +77,40 @@ static int comp_percent(unsigned int orig, unsigned int comp) { void list_alf(void) { unsigned int c = 0, orig_size, comp_size, total_osize = 0, total_csize = 0; char buf[100]; - char *filename; + extern char *out_filename; - puts("Name Length Size now Comp Date Time CkSum"); - puts("============ ======== ======== ==== ========= ====== ====="); + if(opts.verbose_list) { + puts("Name Length Size now Comp Date Time CkSum"); + puts("============ ======== ======== ==== ========= ====== ====="); + } while(read_alf_header()) { c++; orig_size = getquad(alf_hdr_origsize0); comp_size = getquad(alf_hdr_compsize0); - filename = (char *)(mem + alf_hdr_filename); + out_filename = (char *)(mem + alf_hdr_filename); + + if(!opts.verbose_list) + fix_filename(); total_osize += orig_size; total_csize += comp_size; - printf("%-12s ", filename); - printf("%8d ", orig_size); - printf("%8d ", comp_size); - printf("%3d%% ", comp_percent(orig_size, comp_size)); - format_msdos_date(buf); - printf("%9s ", buf); - format_msdos_time(buf); - printf("%6s ", buf); - printf(" %04x", getword(alf_hdr_cksum_l)); - putchar('\n'); + if(opts.verbose_list) { + printf("%-12s ", out_filename); + printf("%8d ", orig_size); + printf("%8d ", comp_size); + printf("%3d%% ", comp_percent(orig_size, comp_size)); + format_msdos_date(buf); + printf("%9s ", buf); + format_msdos_time(buf); + printf("%6s ", buf); + printf(" %04x", getword(alf_hdr_cksum_l)); + putchar('\n'); + } else { + if(file_wanted(out_filename)) + printf("%s\n", out_filename); + } if(fseek(in_file, comp_size, SEEK_CUR) != 0) { fputs(self, stderr); @@ -109,10 +119,12 @@ void list_alf(void) { } } - fputs(" ==== ======== ======== ====\nTotal ", stdout); - printf("%4d ", c); - printf("%8d ", total_osize); - printf("%8d ", total_csize); - printf("%3d%% ", comp_percent(total_osize, total_csize)); - putchar('\n'); + if(opts.verbose_list) { + fputs(" ==== ======== ======== ====\nTotal ", stdout); + printf("%4d ", c); + printf("%8d ", total_osize); + printf("%8d ", total_csize); + printf("%3d%% ", comp_percent(total_osize, total_csize)); + putchar('\n'); + } } |
