summaryrefslogtreecommitdiff
path: root/lib/libc/string/strlen.c
diff options
context:
space:
mode:
authorstefan <stefan@s00.xyz>2023-04-21 21:56:45 -0400
committerstefan <stefan@s00.xyz>2023-04-21 21:56:45 -0400
commit386ad4f82955d389ae347bc50f7efca5edb9d9a8 (patch)
treec18143b0a593e80145f003707a4eb29fa25d0f33 /lib/libc/string/strlen.c
parenteff82c45c589b42061344039d5f2efc8ad7c52df (diff)
downloadsv-386ad4f82955d389ae347bc50f7efca5edb9d9a8.tar.gz
actually got libfdt working
Diffstat (limited to 'lib/libc/string/strlen.c')
-rw-r--r--lib/libc/string/strlen.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/libc/string/strlen.c b/lib/libc/string/strlen.c
new file mode 100644
index 0000000..a1a73b6
--- /dev/null
+++ b/lib/libc/string/strlen.c
@@ -0,0 +1,19 @@
+#include <string.h>
+
+size_t
+strlen(const char *s)
+{
+ int n;
+ for (n = 0; s[n]; n++)
+ ;
+ return n;
+}
+
+size_t
+strnlen(const char *s, size_t max)
+{
+ int n;
+ for (n = 0; s[n] && n < max; n++)
+ ;
+ return n;
+}