From 828b7c1321758d4fea22f4e2bab32c1f768d2e5d Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 16 Aug 2021 19:44:49 +0200 Subject: [PATCH] String library --- src/kernel/lib/string.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/kernel/lib/string.c b/src/kernel/lib/string.c index f9501ae..7b9dcd4 100644 --- a/src/kernel/lib/string.c +++ b/src/kernel/lib/string.c @@ -1,2 +1,8 @@ // Generic String Library #define INDEX(s, c) (int)(c-s) + +unsigned int length(char* str) { + char* p; + for( p = str; *p != '\0'; p++ ) {} + return (unsigned int)(p-str); +}