aboutsummaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authordwminer <daltonminer@gmail.com>2016-11-27 08:54:15 +0100
committerdwminer <daltonminer@gmail.com>2016-11-27 08:59:05 +0100
commit2c566c5320c11e9844f192bfcff2d1a869471415 (patch)
treec9ab67979e064043592bfd0597cf618fff31d79d /options.c
parent32b29e61c1cf1fead8ccc3400d751955de7d5715 (diff)
downloadnsxiv-2c566c5320c11e9844f192bfcff2d1a869471415.tar.zst
Add -A option to force framerate on animated images
Diffstat (limited to 'options.c')
-rw-r--r--options.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/options.c b/options.c
index 4a9772c..b38c146 100644
--- a/options.c
+++ b/options.c
@@ -32,7 +32,7 @@ const options_t *options = (const options_t*) &_options;
void print_usage(void)
{
- printf("usage: sxiv [-abcfhioqrtvZ] [-e WID] [-G GAMMA] [-g GEOMETRY] "
+ printf("usage: sxiv [-abcfhioqrtvZ] [-A FRAMERATE] [-e WID] [-G GAMMA] [-g GEOMETRY] "
"[-N NAME] [-n NUM] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
}
@@ -60,6 +60,7 @@ void parse_options(int argc, char **argv)
_options.animate = false;
_options.gamma = 0;
_options.slideshow = 0;
+ _options.framerate = 0;
_options.fullscreen = false;
_options.embed = 0;
@@ -71,7 +72,7 @@ void parse_options(int argc, char **argv)
_options.thumb_mode = false;
_options.clean_cache = false;
- while ((opt = getopt(argc, argv, "abce:fG:g:hin:N:oqrS:s:tvZz:")) != -1) {
+ while ((opt = getopt(argc, argv, "aA:bce:fG:g:hin:N:oqrS:s:tvZz:")) != -1) {
switch (opt) {
case '?':
print_usage();
@@ -79,6 +80,13 @@ void parse_options(int argc, char **argv)
case 'a':
_options.animate = true;
break;
+ case 'A':
+ _options.animate = true;
+ n = strtol(optarg, &end, 0);
+ if (*end != '\0' || n <= 0)
+ error(EXIT_FAILURE, 0, "Invalid argument for option -A: %s", optarg);
+ _options.framerate = n;
+ break;
case 'b':
_options.hide_bar = true;
break;