From d030c17f644cc726fca6d2216473cfc831185b0f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 6 Jul 2015 20:02:02 +0200 Subject: allow --sort and --randomize to override each other (issue #199) --- ChangeLog | 2 ++ src/options.c | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 985906c..5aa4196 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ git HEAD (patch by James Knight) * when removing the last image in slidsehow mode, stay on the last (previously second-to-last) image (patch by Lior Shiponi) + * Allow --sort and --randomize to override each other (most recently + specified option wins) instead of always preferring --sort Sun, 24 May 2015 11:45:18 +0200 diff --git a/src/options.c b/src/options.c index 120541a..804b485 100644 --- a/src/options.c +++ b/src/options.c @@ -530,6 +530,11 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) "sort by filename", optarg); opt.sort = SORT_FILENAME; } + if (opt.randomize) { + weprintf("commandline contains --randomize and --sort. " + "--randomize has been unset"); + opt.randomize = 0; + } break; case 'T': theme = estrdup(optarg); @@ -644,6 +649,11 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 'z': opt.randomize = 1; + if (opt.sort != SORT_NONE) { + weprintf("commandline contains --sort and --randomize. " + "--sort has been unset"); + opt.sort = SORT_NONE; + } break; case '|': opt.start_list_at = estrdup(optarg); @@ -796,12 +806,6 @@ static void check_options(void) eprintf("You cannot combine --list with other modes"); } - if (opt.sort && opt.randomize) { - weprintf("You cant sort AND randomize the filelist...\n" - "randomize mode has been unset\n"); - opt.randomize = 0; - } - if (opt.loadables && opt.unloadables) { eprintf("You cannot combine --loadable with --unloadable"); } -- cgit v1.2.3