aboutsummaryrefslogtreecommitdiff
path: root/src/listalf.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-12-12 17:15:22 -0500
committerB. Watson <urchlay@slackware.uk>2025-12-12 17:15:22 -0500
commitc0bc883bcfca5791ea64d488caf359a2c8de4360 (patch)
treebc72765712fd1616b68f3e72654df9ee2a289714 /src/listalf.c
parent1fa2b732b7b6c1539995fa40605d9bcf807ac357 (diff)
downloadalftools-c0bc883bcfca5791ea64d488caf359a2c8de4360.tar.gz
Do not print unprintable characters in filenames.
Diffstat (limited to 'src/listalf.c')
-rw-r--r--src/listalf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/listalf.c b/src/listalf.c
index 054fe36..3458bf9 100644
--- a/src/listalf.c
+++ b/src/listalf.c
@@ -76,6 +76,7 @@ void list_alf(void) {
unsigned int c = 0, orig_size, comp_size, total_osize = 0, total_csize = 0;
char buf[100];
extern char *out_filename;
+ int fnlen;
while(read_alf_header()) {
c++;
@@ -98,7 +99,9 @@ void list_alf(void) {
total_csize += comp_size;
if(opts.verbose_list) {
- printf("%-12s ", out_filename);
+ fnlen = safe_print_filename(out_filename, stdout);
+ while(fnlen++ < 14)
+ putchar(' ');
printf("%8d ", orig_size);
printf("%8d ", comp_size);
printf("%3d%% ", comp_percent(orig_size, comp_size));
@@ -109,8 +112,10 @@ void list_alf(void) {
printf(" %04x", getword(alf_hdr_cksum_l));
putchar('\n');
} else {
- if(file_wanted(out_filename))
- printf("%s\n", out_filename);
+ if(file_wanted(out_filename)) {
+ safe_print_filename(out_filename, stdout);
+ putchar('\n');
+ }
}
if(fseek(in_file, comp_size, SEEK_CUR) != 0) {