summaryrefslogtreecommitdiff
path: root/Kernel/StdLib.cpp
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2019-08-10 18:01:33 +0300
committerAndreas Kling <awesomekling@gmail.com>2019-08-11 16:30:43 +0200
commit2396b2ed7066b7aea2eeb7d19564abd9960ea709 (patch)
tree107f9a7f56c1ad6c49e80d7f3e1aa6ac3668b9a4 /Kernel/StdLib.cpp
parentfeabe6ed31489fadb74cabd61e20d644e3a51089 (diff)
downloadserenity-2396b2ed7066b7aea2eeb7d19564abd9960ea709.zip
Kernel: Add strncmp()
Diffstat (limited to 'Kernel/StdLib.cpp')
-rw-r--r--Kernel/StdLib.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp
index 33424f945a..eec8960d0a 100644
--- a/Kernel/StdLib.cpp
+++ b/Kernel/StdLib.cpp
@@ -102,6 +102,14 @@ size_t strlen(const char* str)
return len;
}
+size_t strnlen(const char* str, size_t maxlen)
+{
+ size_t len = 0;
+ for (; len < maxlen && *str; str++)
+ len++;
+ return len;
+}
+
int strcmp(const char* s1, const char* s2)
{
for (; *s1 == *s2; ++s1, ++s2) {