croptool

Image cropping tool
git clone git://lumidify.org/croptool.git (fast, but not encrypted)
git clone https://lumidify.org/git/croptool.git (encrypted, but very slow)
Log | Files | Refs | README | LICENSE

commit 8534d8a6dd745e8007bba613c034fe1d0aef8da5
parent 89b192cbe0b959ae29cbdf20e955452d39e235a2
Author: lumidify <nobody@lumidify.org>
Date:   Sun,  7 Mar 2021 21:53:19 +0100

Remove unloadable files from argument list so they are ignored subsequently

Diffstat:
Mcroptool.1 | 6+++---
Mcroptool.c | 6++++++
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/croptool.1 b/croptool.1 @@ -74,11 +74,11 @@ Print the location of the top side of the cropping rectangle in pixels. Print the location of the bottom side of the cropping rectangle in pixels. .It %f Print the filename of the image. -Warning: This is printed out as is, without any escaping. +Warning: This is printed as is, without any escaping. .El .Pp If an unknown substitution is encountered, a warning is printed to -standard error and the characters are printed out verbatim. +standard error and the characters are printed verbatim. .Sh KEYBINDS .Bl -tag -width Ds .It ARROW LEFT @@ -150,7 +150,7 @@ filenames containing quotes). .Sh AUTHORS .An lumidify Aq Mt nobody@lumidify.org .Sh BUGS -The filenames are printed out without any escaping, so filenames with +The filenames are printed without any escaping, so filenames with quotes may cause issues depending on the output format. .Pp Transparent portions of images should probably be shown differently, diff --git a/croptool.c b/croptool.c @@ -1000,12 +1000,15 @@ next_picture(int copy_box) { /* loop until we find a loadable file */ while (!tmp_image && tmp_cur_selection + 1 < state.num_files) { tmp_cur_selection++; + if (!state.filenames[tmp_cur_selection]) + continue; tmp_image = imlib_load_image_immediately( state.filenames[tmp_cur_selection] ); if (!tmp_image) { fprintf(stderr, "Warning: Unable to load image '%s'.\n", state.filenames[tmp_cur_selection]); + state.filenames[tmp_cur_selection] = NULL; } } if (state.cur_selection < 0 && !tmp_image) { @@ -1029,12 +1032,15 @@ last_picture(void) { /* loop until we find a loadable file */ while (!tmp_image && tmp_cur_selection > 0) { tmp_cur_selection--; + if (!state.filenames[tmp_cur_selection]) + continue; tmp_image = imlib_load_image_immediately( state.filenames[tmp_cur_selection] ); if (!tmp_image) { fprintf(stderr, "Warning: Unable to load image '%s'.\n", state.filenames[tmp_cur_selection]); + state.filenames[tmp_cur_selection] = NULL; } }