summaryrefslogtreecommitdiff
path: root/usr/sdk/common/string/strlen.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-12-21 17:14:52 -0500
committerIan Moffett <ian@osmora.org>2025-12-21 17:14:52 -0500
commitea8882dd7c024db436e25e86ac3d3fa3b3e43aa0 (patch)
tree1fbbecbc43c057f74c959e7e2a63ecb25a548951 /usr/sdk/common/string/strlen.c
parent580df110a231be68c64f5fe061e12fae9fbcc4cd (diff)
usr: sdk: Add initial string lib sources + strlen
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr/sdk/common/string/strlen.c')
-rw-r--r--usr/sdk/common/string/strlen.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/usr/sdk/common/string/strlen.c b/usr/sdk/common/string/strlen.c
new file mode 100644
index 0000000..4499512
--- /dev/null
+++ b/usr/sdk/common/string/strlen.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025, Ian Moffett.
+ * Provided under the BSD-3 clause.
+ */
+
+#include <sdk/string.h>
+#include <sdk/types.h>
+
+USIZE
+strlen(const char *str)
+{
+ USIZE len = 0;
+
+ if (str == NULL) {
+ return 0;
+ }
+
+ while (str[len++] != '\0');
+ return len - 1;
+}