Second Extended Filesystem (ext2) and other improvements (#33)
[lunaix-os.git] / lunaix-os / libs / klibc / string / strcmp.c
index 736bb910b741addb016d891ff4ec79a28397fae6..072912bcea7b0683bc6b443cc8728b8fe7bc1092 100644 (file)
@@ -1,6 +1,7 @@
 #include <klibc/string.h>
 #include <klibc/string.h>
+#include <lunaix/compiler.h>
 
 
-int
+int weak
 streq(const char* a, const char* b)
 {
     while (*a == *b) {
 streq(const char* a, const char* b)
 {
     while (*a == *b) {
@@ -11,4 +12,18 @@ streq(const char* a, const char* b)
         b++;
     }
     return 0;
         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
 }
\ No newline at end of file