diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-04-14 16:28:51 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2014-04-14 16:28:51 +0200 |
commit | ece02b618b414244ef8247bd727e30e664249f77 (patch) | |
tree | 1df8fda0e149afad66f131cddbbe5077589b123b /src/utils.c | |
parent | ad285742e9f2111e4ae3d05deb41bfebbce58025 (diff) |
Use new path_is_url helper instead of repeated strncmp chains
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index 037010e..bd189d3 100644 --- a/src/utils.c +++ b/src/utils.c @@ -143,6 +143,15 @@ char *estrjoin(const char *separator, ...) return string; } +char path_is_url(char *path) { + if ((!strncmp(path, "http://", 7)) + || (!strncmp(path, "https://", 8)) + || (!strncmp(path, "ftp://", 6)) + || (!strncmp(path, "file://", 7))) + return 1; + return 0; +} + /* free the result please */ char *feh_unique_filename(char *path, char *basename) { |