diff options
Diffstat (limited to 'src/userspace/libc/string/strncmp.c')
-rw-r--r-- | src/userspace/libc/string/strncmp.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/userspace/libc/string/strncmp.c b/src/userspace/libc/string/strncmp.c new file mode 100644 index 0000000..450fbd8 --- /dev/null +++ b/src/userspace/libc/string/strncmp.c @@ -0,0 +1,16 @@ +int strncmp(char *s1, char *s2, int c) +{ + int result = 0; + + while (c) { + result = *s1 - *s2++; + + if ((result != 0) || (*s1++ == 0)) { + break; + } + + c--; + } + + return result; +}
\ No newline at end of file |