allow disabling animation playback via -A 0

ref: https://codeberg.org/nsxiv/nsxiv/issues/404
This commit is contained in:
NRK 2024-06-14 00:32:06 +00:00
parent 11558c9fcf
commit 55d60319db
2 changed files with 6 additions and 2 deletions

View file

@ -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.

View file

@ -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;