diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-01-25 18:23:36 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-01-25 18:23:36 +0100 |
commit | 4c09df3e7d47326494c76dd8b1a200274f5d1fe7 (patch) | |
tree | 909d66622295078fc5605e95de3cc4bb4dd1ddbb | |
parent | eb266c74c86caf7bef1d02dd3ac2c5902dc98827 (diff) | |
download | feh-4c09df3e7d47326494c76dd8b1a200274f5d1fe7.zip |
options.c: Move hold-action check to check_options.
In feh_parse_option_array, when a hold-action is set from a theme it would
behave differently than one set from commandline.
Theme: ;;foo would become foo (incorrect)
cmdline: ;;foo would become ;foo (correct)
I doubt anybody would ever have noticed it, since ;foo is a shell syntax error
anyways, but it's definitely better to be on the safe side.
-rw-r--r-- | src/options.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/options.c b/src/options.c index 78e768e..6427597 100644 --- a/src/options.c +++ b/src/options.c @@ -429,7 +429,6 @@ static void feh_parse_option_array(int argc, char **argv) {0, 0, 0, 0} }; int optch = 0, cmdx = 0; - int i = 0; /* Now to pass some optionarinos */ while ((optch = getopt_long(argc, argv, stropts, lopts, &cmdx)) != EOF) { @@ -791,13 +790,6 @@ static void feh_parse_option_array(int argc, char **argv) } } - for (i = 0; i < 10; i++) { - if (opt.actions[i] && !opt.hold_actions[i] && (opt.actions[i][0] == ';')) { - opt.hold_actions[i] = 1; - opt.actions[i] = &opt.actions[i][1]; - } - } - /* So that we can safely be called again */ optind = 1; return; @@ -805,6 +797,14 @@ static void feh_parse_option_array(int argc, char **argv) static void check_options(void) { + int i; + for (i = 0; i < 10; i++) { + if (opt.actions[i] && !opt.hold_actions[i] && (opt.actions[i][0] == ';')) { + opt.hold_actions[i] = 1; + opt.actions[i] = &opt.actions[i][1]; + } + } + if ((opt.index + opt.collage) > 1) { weprintf("you can't use collage mode and index mode together.\n" " I'm going with index"); |