diff options
Diffstat (limited to 'src/filelist.c')
-rw-r--r-- | src/filelist.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/src/filelist.c b/src/filelist.c index d5b0750..49355c4 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -28,6 +28,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <libexif/exif-data.h> #endif +#ifdef HAVE_LIBCURL +#include <curl/curl.h> +#endif + #include "feh.h" #include "filelist.h" #include "signals.h" @@ -402,7 +406,6 @@ void feh_file_dirname(char *dst, feh_file * f, int maxlen) dst[n] = '\0'; } -#ifdef HAVE_VERSCMP static inline int strcmp_or_strverscmp(const char *s1, const char *s2) { if (!opt.version_sort) @@ -410,9 +413,6 @@ static inline int strcmp_or_strverscmp(const char *s1, const char *s2) else return(strverscmp(s1, s2)); } -#else -#define strcmp_or_strverscmp strcmp -#endif int feh_cmp_filename(void *file1, void *file2) { @@ -664,8 +664,17 @@ char *feh_absolute_path(char *path) void feh_save_filelist() { char *tmpname; + char *base_dir = ""; + + if (opt.output_dir) { + base_dir = estrjoin("", opt.output_dir, "/", NULL); + } + + tmpname = feh_unique_filename(base_dir, "filelist"); - tmpname = feh_unique_filename("", "filelist"); + if (opt.output_dir) { + free(base_dir); + } if (opt.verbose) fprintf(stderr, "saving filelist to filename '%s'\n", tmpname); @@ -674,3 +683,27 @@ void feh_save_filelist() free(tmpname); return; } + +#ifdef HAVE_LIBCURL + +char *feh_http_unescape(char *url) +{ + CURL *curl = curl_easy_init(); + if (!curl) { + return NULL; + } + char *tmp_url = curl_easy_unescape(curl, url, 0, NULL); + char *new_url = estrdup(tmp_url); + curl_free(tmp_url); + curl_easy_cleanup(curl); + return new_url; +} + +#else + +char *feh_http_unescape(char *url) +{ + return NULL; +} + +#endif |