diff options
Diffstat (limited to 'src/list.c')
-rw-r--r-- | src/list.c | 48 |
1 files changed, 36 insertions, 12 deletions
@@ -1,6 +1,7 @@ /* list.c Copyright (C) 1999-2003 Tom Gilbert. +Copyright (C) 2010-2024 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -36,20 +37,24 @@ void init_list_mode(void) mode = "list"; if (!opt.customlist) - printf("NUM\tFORMAT\tWIDTH\tHEIGHT\tPIXELS\tSIZE(bytes)\tALPHA\tFILENAME\n"); + fputs("NUM\tFORMAT\tWIDTH\tHEIGHT\tPIXELS\tSIZE\tALPHA\tFILENAME\n", + stdout); for (l = filelist; l; l = l->next) { file = FEH_FILE(l->data); if (opt.customlist) - printf("%s\n", feh_printf(opt.customlist, file)); - else - printf("%d\t%s\t%d\t%d\t%d\t%d\t\t%c\t%s\n", ++j, + printf("%s\n", feh_printf(opt.customlist, file, NULL)); + else { + printf("%d\t%s\t%d\t%d\t%s", ++j, file->info->format, file->info->width, - file->info->height, file->info->pixels, - file->info->size, + file->info->height, + format_size(file->info->pixels)); + printf("\t%s\t%c\t%s\n", + format_size(file->size), file->info->has_alpha ? 'X' : '-', file->filename); + } - feh_action_run(file, opt.actions[0]); + feh_action_run(file, opt.actions[0], NULL); } exit(0); } @@ -72,6 +77,7 @@ void real_loadables_mode(int loadable) { feh_file *file; gib_list *l; + char ret = 0; opt.quiet = 1; @@ -83,17 +89,35 @@ void real_loadables_mode(int loadable) if (feh_load_image(&im, file)) { /* loaded ok */ if (loadable) { - fprintf(stdout, "%s\n", file->filename); - feh_action_run(file, opt.actions[0]); + if (opt.verbose) + feh_display_status('.'); + puts(file->filename); + fflush(stdout); + feh_action_run(file, opt.actions[0], NULL); + } + else { + if (opt.verbose) + feh_display_status('s'); + ret = 1; } gib_imlib_free_image_and_decache(im); } else { /* Oh dear. */ if (!loadable) { - fprintf(stdout, "%s\n", file->filename); - feh_action_run(file, opt.actions[0]); + if (opt.verbose) + feh_display_status('.'); + puts(file->filename); + fflush(stdout); + feh_action_run(file, opt.actions[0], NULL); + } + else { + if (opt.verbose) + feh_display_status('s'); + ret = 1; } } } - exit(0); + if (opt.verbose) + feh_display_status(0); + exit(ret); } |