diff options
Diffstat (limited to 'libc-top-half/musl/src/string/strncmp.c')
-rw-r--r-- | libc-top-half/musl/src/string/strncmp.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/string/strncmp.c b/libc-top-half/musl/src/string/strncmp.c new file mode 100644 index 0000000..e228843 --- /dev/null +++ b/libc-top-half/musl/src/string/strncmp.c @@ -0,0 +1,9 @@ +#include <string.h> + +int strncmp(const char *_l, const char *_r, size_t n) +{ + const unsigned char *l=(void *)_l, *r=(void *)_r; + if (!n--) return 0; + for (; *l && *r && n && *l == *r ; l++, r++, n--); + return *l - *r; +} |