diff options
Diffstat (limited to 'src/include/string.h')
-rw-r--r-- | src/include/string.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/string.h b/src/include/string.h index 25e741e810..d82b3ac1c4 100644 --- a/src/include/string.h +++ b/src/include/string.h @@ -81,6 +81,18 @@ static inline int strcmp(const char *s1, const char *s2) return r; } +static inline int strncmp(const char *s1, const char *s2, int maxlen) +{ + int i; + + for (i = 0; i < maxlen; i++) { + if (s1[i] != s2[i]) + return s1[i] - s2[i]; + } + + return 0; +} + static inline int isspace(int c) { switch (c) { |