summaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/options.c b/src/options.c
index 2cd7a9e..4744bb0 100644
--- a/src/options.c
+++ b/src/options.c
@@ -433,6 +433,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
#endif
{"class" , 1, 0, 249},
{"no-conversion-cache", 0, 0, 250},
+ {"window-id", 1, 0, 251},
{0, 0, 0, 0}
};
int optch = 0, cmdx = 0;
@@ -833,6 +834,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
case 250:
opt.use_conversion_cache = 0;
break;
+ case 251:
+ opt.x11_windowid = atol(optarg);
+ break;
default:
break;
}
@@ -855,11 +859,26 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
*/
if (opt.start_list_at && path_is_url(opt.start_list_at) && (strlen(opt.start_list_at) <= 8 || strncmp(opt.start_list_at, "file:///", 8) != 0)) {
add_file_to_filelist_recursively(opt.start_list_at, FILELIST_FIRST);
+ /*
+ * Otherwise, make "feh --start-at dir/file.jpg" behave like
+ * "feh --start-at dir/file.jpg dir".
+ */
} else if (opt.start_list_at && strrchr(opt.start_list_at, '/')) {
+ /*
+ * feh can't candle urlencoded path components ("some%20dir" etc).
+ * Use libcurl to unescape them if --start-at is file://...
+ */
if (strlen(opt.start_list_at) > 8 && strncmp(opt.start_list_at, "file:///", 8) == 0) {
- char *start_at_path = estrdup(opt.start_list_at + 7);
- free(opt.start_list_at);
- opt.start_list_at = start_at_path;
+ char *unescaped_path = feh_http_unescape(opt.start_list_at);
+ if (unescaped_path != NULL) {
+ free(opt.start_list_at);
+ opt.start_list_at = estrdup(unescaped_path + 7);
+ free(unescaped_path);
+ } else {
+ char *new_path = estrdup(opt.start_list_at + 7);
+ free(opt.start_list_at);
+ opt.start_list_at = new_path;
+ }
}
char *target_directory = estrdup(opt.start_list_at);
char *filename_start = strrchr(target_directory, '/');
@@ -943,8 +962,8 @@ static void show_version(void)
"stat64 "
#endif
-#ifdef HAVE_VERSCMP
- "verscmp "
+#ifdef HAVE_STRVERSCMP
+ "verscmp "
#endif
#ifdef HAVE_LIBXINERAMA