Commit 4c09df3e authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

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.
parent eb266c74
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -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");