path-util: add path_startswith_strv()

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-07-19 16:49:41 +02:00
parent 771fded37f
commit cc4d7d818d
3 changed files with 37 additions and 11 deletions
+12
View File
@@ -207,6 +207,18 @@ int path_make_relative(const char *from_dir, const char *to_path, char **_r) {
return 0;
}
char* path_startswith_strv(const char *p, char **set) {
char **s, *t;
STRV_FOREACH(s, set) {
t = path_startswith(p, *s);
if (t)
return t;
}
return NULL;
}
int path_strv_make_absolute_cwd(char **l) {
char **s;
int r;