From 88c00512e60bc89d9c857aba24bfc6a93c77a577 Mon Sep 17 00:00:00 2001 From: Thorsten Töpper Date: Tue, 8 Jul 2025 23:51:10 +0200 Subject: output print_list_formatted: summary like print_list --- src/output.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/output.c b/src/output.c index 93ef6f5..45f04a6 100644 --- a/src/output.c +++ b/src/output.c @@ -433,6 +433,7 @@ void print_list_formatted(const char *format, struct list_head *list) { struct list_head *lh = list; struct list_node *ptr; size_t format_len = 0, i = 0; + size_t total_size = 0; if (format == NULL || format[0] == '\0') { LOGERR("ERROR: No format string given"); @@ -509,8 +510,12 @@ void print_list_formatted(const char *format, struct list_head *list) { }; } out_print_newline(); + total_size += (ptr->ln_stat.st_size>0) ? (unsigned long int)ptr->ln_stat.st_size : 0; ptr = ptr->next; } + fputc_all_cols('=', stdout); + printf("\nTotal size: %lu %s\n", ((total_size>1024) ? total_size/1024 : total_size), + ((total_size >= 1024) ? "kB" : "")); if (lh != list) destroy_list(lh); } -- cgit v1.2.3-70-g09d2