summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-07-06 20:02:02 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-07-06 20:02:02 +0200
commitd030c17f644cc726fca6d2216473cfc831185b0f (patch)
tree73ff7cde1dc70e35afd72ec7927790aea889344c
parentb9c2f2c11d2d90ca9d6b3ea9d999ff835fc5706a (diff)
allow --sort and --randomize to override each other (issue #199)
-rw-r--r--ChangeLog2
-rw-r--r--src/options.c16
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");
}