diff options
author | Bert Münnich <ber.t@posteo.de> | 2013-11-14 14:47:36 +0100 |
---|---|---|
committer | Bert Münnich <ber.t@posteo.de> | 2013-11-14 14:47:36 +0100 |
commit | 2737fc8b81829372d454f407e19733d66d964272 (patch) | |
tree | 976ee138e2fdcaba94c3c17073720834c1b45aa6 /options.c | |
parent | 38bc23405d619a7ba430731f141157104f2267f9 (diff) | |
parent | 0353e6eea265f5f6fa53eb75300529d9ffa6d4fa (diff) | |
download | nsxiv-2737fc8b81829372d454f407e19733d66d964272.tar.zst |
Merge remote-tracking branch 'ariand/gamma'
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options; void print_usage(void) { - printf("usage: sxiv [-bcdFfhioqrstvZ] [-g GEOMETRY] [-n NUM] " + printf("usage: sxiv [-bcdFfhioqrstvZ] [-g GEOMETRY] [-G GAMMA] [-n NUM] " "[-N name] [-z ZOOM] FILES...\n"); } @@ -44,7 +44,7 @@ void print_version(void) void parse_options(int argc, char **argv) { - int opt, t; + int opt, t, gamma; _options.from_stdin = false; _options.to_stdout = false; @@ -53,6 +53,7 @@ void parse_options(int argc, char **argv) _options.scalemode = SCALE_MODE; _options.zoom = 1.0; + _options.gamma = 0; _options.fixed_win = false; _options.fullscreen = false; @@ -64,7 +65,7 @@ void parse_options(int argc, char **argv) _options.thumb_mode = false; _options.clean_cache = false; - while ((opt = getopt(argc, argv, "bcdFfg:hin:N:oqrstvZz:")) != -1) { + while ((opt = getopt(argc, argv, "bcdFfg:G:hin:N:oqrstvZz:")) != -1) { switch (opt) { case '?': print_usage(); @@ -87,6 +88,14 @@ void parse_options(int argc, char **argv) case 'g': _options.geometry = optarg; break; + case 'G': + if (sscanf(optarg, "%d", &gamma) <= 0) { + fprintf(stderr, "sxiv: invalid argument for option -G: %s\n", + optarg); + exit(EXIT_FAILURE); + } + _options.gamma = gamma; + break; case 'h': print_usage(); exit(EXIT_SUCCESS); |