Refactored remote changes

This commit is contained in:
Bert Münnich
2013-11-14 17:06:20 +01:00
parent 2737fc8b81
commit 50f9ad14de
7 changed files with 66 additions and 46 deletions

View File

@ -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);