diff options
| author | Thorsten Töpper <atsutane@freethoughts.de> | 2025-07-08 23:51:10 +0200 |
|---|---|---|
| committer | Thorsten Töpper <atsutane@freethoughts.de> | 2025-07-08 23:51:10 +0200 |
| commit | 88c00512e60bc89d9c857aba24bfc6a93c77a577 (patch) | |
| tree | 3e8c4ea0e62dc9847a2667b2b6575ba6e7f78142 /src | |
| parent | 0d5141bbdd20f02c796365453581a4849debeca5 (diff) | |
| download | dir_monitor-88c00512e60bc89d9c857aba24bfc6a93c77a577.tar.gz dir_monitor-88c00512e60bc89d9c857aba24bfc6a93c77a577.tar.bz2 | |
output print_list_formatted: summary like print_list
Diffstat (limited to 'src')
| -rw-r--r-- | src/output.c | 5 |
1 files changed, 5 insertions, 0 deletions
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); } |
