summaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authorAndrás Mohari <andras.mohari@gmail.com>2013-11-13 20:54:09 +0100
committerAndrás Mohari <andras.mohari@gmail.com>2013-11-13 20:54:09 +0100
commit0353e6eea265f5f6fa53eb75300529d9ffa6d4fa (patch)
tree8b1e30131ec3eb3edd4cd7df7d955db3270b0c17 /options.c
parent450c1ed9b54de4d374bff80735c874bb6f7a4a0f (diff)
downloadnsxiv-0353e6eea265f5f6fa53eb75300529d9ffa6d4fa.tar.zst
Add support for changing the gamma value
Diffstat (limited to 'options.c')
-rw-r--r--options.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/options.c b/options.c
index e47ad37..574f871 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] [-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);