summaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2013-11-14 17:06:20 +0100
committerBert Münnich <ber.t@posteo.de>2013-11-14 17:06:20 +0100
commit50f9ad14de921295d7a1687799e30562808e940a (patch)
tree0176dbb630a74ba38a610020ad1802a8ae3d3fa1 /options.c
parent2737fc8b81829372d454f407e19733d66d964272 (diff)
downloadnsxiv-50f9ad14de921295d7a1687799e30562808e940a.tar.zst
Refactored remote changes
Diffstat (limited to 'options.c')
-rw-r--r--options.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/options.c b/options.c
index 574f871..e4d597c 100644
--- a/options.c
+++ b/options.c
@@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options;
void print_usage(void)
{
- printf("usage: sxiv [-bcdFfhioqrstvZ] [-g GEOMETRY] [-G GAMMA] [-n NUM] "
+ printf("usage: sxiv [-bcdFfhioqrstvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
"[-N name] [-z ZOOM] FILES...\n");
}
@@ -45,6 +45,7 @@ void print_version(void)
void parse_options(int argc, char **argv)
{
int opt, t, gamma;
+ char *end;
_options.from_stdin = false;
_options.to_stdout = false;
@@ -65,7 +66,7 @@ void parse_options(int argc, char **argv)
_options.thumb_mode = false;
_options.clean_cache = false;
- while ((opt = getopt(argc, argv, "bcdFfg:G:hin:N:oqrstvZz:")) != -1) {
+ while ((opt = getopt(argc, argv, "bcdFfG:g:hin:N:oqrstvZz:")) != -1) {
switch (opt) {
case '?':
print_usage();
@@ -85,17 +86,18 @@ void parse_options(int argc, char **argv)
case 'f':
_options.fullscreen = true;
break;
- case 'g':
- _options.geometry = optarg;
- break;
case 'G':
- if (sscanf(optarg, "%d", &gamma) <= 0) {
+ gamma = strtol(optarg, &end, 0);
+ if (*end != '\0') {
fprintf(stderr, "sxiv: invalid argument for option -G: %s\n",
optarg);
exit(EXIT_FAILURE);
}
_options.gamma = gamma;
break;
+ case 'g':
+ _options.geometry = optarg;
+ break;
case 'h':
print_usage();
exit(EXIT_SUCCESS);