summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/string.c b/string.c
index 54f4ba8..c88e7de 100644
--- a/string.c
+++ b/string.c
@@ -58,3 +58,14 @@ memmove(void *dst, const void *src, unsigned n)
return dst;
}
+
+int
+strncmp(const char *p, const char *q, unsigned n)
+{
+ while (n > 0 && *p && *p == *q)
+ n--, p++, q++;
+ if (n == 0)
+ return 0;
+ else
+ return (int) ((unsigned char) *p - (unsigned char) *q);
+}