summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-08-02 22:30:23 +0000
committerJoursoir <chat@joursoir.net>2021-08-02 22:30:23 +0000
commit73ba11fe151f6e643f187f3abd22f1fe0fcb743e (patch)
tree8821b41af701d4e09e4e72d4099199ffaa44678f
parent39f626a5d0cf0f5db95e695d013b70a04c29348e (diff)
downloadmfsos-73ba11fe151f6e643f187f3abd22f1fe0fcb743e.tar.gz
mfsos-73ba11fe151f6e643f187f3abd22f1fe0fcb743e.tar.bz2
mfsos-73ba11fe151f6e643f187f3abd22f1fe0fcb743e.zip
string: move strlen() here
-rw-r--r--kernel/string.c9
-rw-r--r--kernel/string.h9
2 files changed, 18 insertions, 0 deletions
diff --git a/kernel/string.c b/kernel/string.c
new file mode 100644
index 0000000..d038c27
--- /dev/null
+++ b/kernel/string.c
@@ -0,0 +1,9 @@
+#include "string.h"
+
+size_t strlen(const char *str)
+{
+ size_t len = 0;
+ while(str[len])
+ len++;
+ return len;
+}
diff --git a/kernel/string.h b/kernel/string.h
new file mode 100644
index 0000000..dc760a5
--- /dev/null
+++ b/kernel/string.h
@@ -0,0 +1,9 @@
+#ifndef KERNEL_STRING
+#define KERNEL_STRING
+
+#include <stddef.h>
+#include <stdint.h>
+
+size_t strlen(const char *str);
+
+#endif /* KERNEL_STRING */