diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/string.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/string.c b/src/lib/string.c index 365381b..d50435f 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -37,6 +37,18 @@ char *strcpy(char *restrict dst, const char *restrict src) return dst; } +int strncmp(const char *s1, const char *s2, size_t n) +{ + int i = 0; + + for (i = 0; i < n; i++) { + if (s1[i] != s2[i]) + return s1[i] - s2[i]; + } + + return 0; +} + void *memset(void *s, int c, size_t n) { char *cur = (char*) s; |
