From 55d60319db82fde32696106259688a22ab6d1bf5 Mon Sep 17 00:00:00 2001 From: NRK Date: Fri, 14 Jun 2024 00:32:06 +0000 Subject: [PATCH] allow disabling animation playback via -A 0 ref: https://codeberg.org/nsxiv/nsxiv/issues/404 --- etc/nsxiv.1 | 3 +++ options.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/nsxiv.1 b/etc/nsxiv.1 index 999f91b..2c3c910 100644 --- a/etc/nsxiv.1 +++ b/etc/nsxiv.1 @@ -37,6 +37,9 @@ manager. .BI "\-A, \-\-framerate " FRAMERATE Play animations with a constant frame rate set to .IR FRAMERATE . +If +.I FRAMERATE +is set to 0 then animation playback is disabled. .TP .B "\-a, \-\-animate" Play animations of multi-frame images. diff --git a/options.c b/options.c index b9a244c..af54103 100644 --- a/options.c +++ b/options.c @@ -171,10 +171,11 @@ void parse_options(int argc, char **argv) exit(EXIT_FAILURE); case 'A': n = strtol(op.optarg, &end, 0); - if (*end != '\0' || n <= 0 || n > INT_MAX) + if (*end != '\0' || n < 0 || n > INT_MAX) error(EXIT_FAILURE, 0, "Invalid framerate: %s", op.optarg); _options.framerate = n; - /* fall through */ + _options.animate = n > 0; + break; case 'a': _options.animate = true; break;