Refactored remote changes
This commit is contained in:
14
options.c
14
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);
|
||||
|
Reference in New Issue
Block a user