X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Futil.c;h=7be18596a4cc1dabb2b2aa1a05551a0b8a3acdb4;hb=ab16e737cf21ee1746868e027448d02de00954f7;hp=dc86d103fc77ddbe5975c523d1d023efbc0371af;hpb=6c206da1b97ad86e095d383f4ebd3d8f332ad416;p=andemo diff --git a/src/util.c b/src/util.c index dc86d10..7be1859 100644 --- a/src/util.c +++ b/src/util.c @@ -41,3 +41,14 @@ char *strdup_nf_impl(const char *s, const char *file, int line) } return res; } + + +int match_prefix(const char *str, const char *prefix) +{ + while(*str && *prefix) { + if(*str++ != *prefix++) { + return 0; + } + } + return *prefix ? 0 : 1; +}