From ea8882dd7c024db436e25e86ac3d3fa3b3e43aa0 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 21 Dec 2025 17:14:52 -0500 Subject: usr: sdk: Add initial string lib sources + strlen Signed-off-by: Ian Moffett --- usr/sdk/common/string/strlen.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 usr/sdk/common/string/strlen.c (limited to 'usr/sdk/common/string/strlen.c') 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 +#include + +USIZE +strlen(const char *str) +{ + USIZE len = 0; + + if (str == NULL) { + return 0; + } + + while (str[len++] != '\0'); + return len - 1; +} -- cgit v1.2.3