summaryrefslogtreecommitdiff
path: root/tools/lib/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/string.c')
-rw-r--r--tools/lib/string.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/lib/string.c b/tools/lib/string.c
index bd239bc1d557..8e678af1c6ee 100644
--- a/tools/lib/string.c
+++ b/tools/lib/string.c
@@ -87,3 +87,12 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size)
}
return ret;
}
+
+int prefixcmp(const char *str, const char *prefix)
+{
+ for (; ; str++, prefix++)
+ if (!*prefix)
+ return 0;
+ else if (*str != *prefix)
+ return (unsigned char)*prefix - (unsigned char)*str;
+}