aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/nolibc/string.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/include/nolibc/string.h')
-rw-r--r--tools/include/nolibc/string.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/include/nolibc/string.h b/tools/include/nolibc/string.h
index 4554b6fcb400..0d5e870c7c0b 100644
--- a/tools/include/nolibc/string.h
+++ b/tools/include/nolibc/string.h
@@ -103,6 +103,17 @@ char *strchr(const char *s, int c)
}
static __attribute__((unused))
+int strcmp(const char *a, const char *b)
+{
+ unsigned int c;
+ int diff;
+
+ while (!(diff = (unsigned char)*a++ - (c = (unsigned char)*b++)) && c)
+ ;
+ return diff;
+}
+
+static __attribute__((unused))
char *strcpy(char *dst, const char *src)
{
char *ret = dst;
@@ -184,6 +195,18 @@ char *strncat(char *dst, const char *src, size_t size)
return orig;
}
+static __attribute__((unused))
+int strncmp(const char *a, const char *b, size_t size)
+{
+ unsigned int c;
+ int diff = 0;
+
+ while (size-- &&
+ !(diff = (unsigned char)*a++ - (c = (unsigned char)*b++)) && c)
+ ;
+
+ return diff;
+}
static __attribute__((unused))
char *strncpy(char *dst, const char *src, size_t size)