summaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'options.c')
-rw-r--r--options.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/options.c b/options.c
index cb53794..258dc37 100644
--- a/options.c
+++ b/options.c
@@ -32,8 +32,9 @@ const options_t *options = (const options_t*) &_options;
void print_usage(void)
{
- printf("usage: sxiv [-abcfhioqrtvZ] [-e WID] [-G GAMMA] [-g GEOMETRY] "
- "[-N NAME] [-n NUM] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
+ printf("usage: sxiv [-abcfhioqrtvZ] [-A FRAMERATE] [-e WID] [-G GAMMA] "
+ "[-g GEOMETRY] [-N NAME] [-n NUM] [-S DELAY] [-s MODE] [-z ZOOM] "
+ "FILES...\n");
}
void print_version(void)
@@ -44,7 +45,6 @@ void print_version(void)
void parse_options(int argc, char **argv)
{
int n, opt;
- float f;
char *end, *s;
const char *scalemodes = "dfwh";
@@ -60,7 +60,8 @@ void parse_options(int argc, char **argv)
_options.zoom = 1.0;
_options.animate = false;
_options.gamma = 0;
- _options.slideshow = 0.0;
+ _options.slideshow = 0;
+ _options.framerate = 0;
_options.fullscreen = false;
_options.embed = 0;
@@ -72,11 +73,17 @@ 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, "A:abce:fG:g:hin:N:oqrS:s:tvZz:")) != -1) {
switch (opt) {
case '?':
print_usage();
exit(EXIT_FAILURE);
+ case 'A':
+ n = strtol(optarg, &end, 0);
+ if (*end != '\0' || n <= 0)
+ error(EXIT_FAILURE, 0, "Invalid argument for option -A: %s", optarg);
+ _options.framerate = n;
+ /* fall through */
case 'a':
_options.animate = true;
break;
@@ -129,10 +136,10 @@ void parse_options(int argc, char **argv)
_options.recursive = true;
break;
case 'S':
- f = (float) strtof(optarg, &end);
- if (*end != '\0' || f <= 0.0)
+ n = strtof(optarg, &end) * 10;
+ if (*end != '\0' || n <= 0)
error(EXIT_FAILURE, 0, "Invalid argument for option -S: %s", optarg);
- _options.slideshow = (float) f;
+ _options.slideshow = n;
break;
case 's':
s = strchr(scalemodes, optarg[0]);