aboutsummaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authorDon Hejna <don.hejna@gmail.com>2016-11-28 05:36:23 +0100
committerDon Hejna <don.hejna@gmail.com>2016-11-28 05:36:23 +0100
commit27bbaab976e02d2458099de96ec71d14aa1ade8e (patch)
treeda6373d93c95bafc431fa4adfd025312173f5fca /options.c
parent32b29e61c1cf1fead8ccc3400d751955de7d5715 (diff)
downloadnsxiv-27bbaab976e02d2458099de96ec71d14aa1ade8e.tar.zst
Support for DELAY as a floating point number including less than 1
second while maintaining backward compatibiitiy with integer arguments.
Diffstat (limited to 'options.c')
-rw-r--r--options.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/options.c b/options.c
index 4a9772c..cb53794 100644
--- a/options.c
+++ b/options.c
@@ -44,6 +44,7 @@ void print_version(void)
void parse_options(int argc, char **argv)
{
int n, opt;
+ float f;
char *end, *s;
const char *scalemodes = "dfwh";
@@ -59,7 +60,7 @@ void parse_options(int argc, char **argv)
_options.zoom = 1.0;
_options.animate = false;
_options.gamma = 0;
- _options.slideshow = 0;
+ _options.slideshow = 0.0;
_options.fullscreen = false;
_options.embed = 0;
@@ -128,10 +129,10 @@ void parse_options(int argc, char **argv)
_options.recursive = true;
break;
case 'S':
- n = strtol(optarg, &end, 0);
- if (*end != '\0' || n <= 0)
+ f = (float) strtof(optarg, &end);
+ if (*end != '\0' || f <= 0.0)
error(EXIT_FAILURE, 0, "Invalid argument for option -S: %s", optarg);
- _options.slideshow = n;
+ _options.slideshow = (float) f;
break;
case 's':
s = strchr(scalemodes, optarg[0]);