From 73ba11fe151f6e643f187f3abd22f1fe0fcb743e Mon Sep 17 00:00:00 2001 From: Joursoir Date: Mon, 2 Aug 2021 22:30:23 +0000 Subject: string: move strlen() here --- kernel/string.c | 9 +++++++++ kernel/string.h | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 kernel/string.c create mode 100644 kernel/string.h 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 +#include + +size_t strlen(const char *str); + +#endif /* KERNEL_STRING */ -- cgit v1.2.3-18-g5258