X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/0e1309c02f0703c050df09b71346dab60fc6df87..270869139db617e29a35bb9ded41087bb702f9ac:/lunaix-os/libs/klibc/string/strcmp.c diff --git a/lunaix-os/libs/klibc/string/strcmp.c b/lunaix-os/libs/klibc/string/strcmp.c index 736bb91..072912b 100644 --- a/lunaix-os/libs/klibc/string/strcmp.c +++ b/lunaix-os/libs/klibc/string/strcmp.c @@ -1,6 +1,7 @@ #include +#include -int +int weak streq(const char* a, const char* b) { while (*a == *b) { @@ -11,4 +12,18 @@ streq(const char* a, const char* b) b++; } return 0; +} + +int +strneq(const char* a, const char* b, unsigned long n) +{ + while (n-- && *a == *b) { + if (!(*a)) { + return 1; + } + + a++; + b++; + } + return !(n + 1); } \ No newline at end of file