X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fstrv.c;h=0df978d23b911f53be7e7c597e01c8b26c28a2a6;hb=28849dbadb7cd127f7f89e8892ec94c6a05070da;hp=6448f3170fc837ac6ef7035fb8506bc9c430ab52;hpb=f49650cee2c5256dc0491432e1f12a4ae19be6c5;p=elogind.git diff --git a/src/shared/strv.c b/src/shared/strv.c index 6448f3170..0df978d23 100644 --- a/src/shared/strv.c +++ b/src/shared/strv.c @@ -52,6 +52,23 @@ char *strv_find_prefix(char **l, const char *name) { return NULL; } +char *strv_find_startswith(char **l, const char *name) { + char **i, *e; + + assert(name); + + /* Like strv_find_prefix, but actually returns only the + * suffix, not the whole item */ + + STRV_FOREACH(i, l) { + e = startswith(*i, name); + if (e) + return e; + } + + return NULL; +} + void strv_free(char **l) { char **k;