From 6af21e6a4f2251e71353562d5df7f376fdffc270 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Tue, 25 Mar 2025 17:36:52 -0400 Subject: initial checkout from wrc --- lib/strlen.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/strlen.c (limited to 'lib/strlen.c') diff --git a/lib/strlen.c b/lib/strlen.c new file mode 100644 index 0000000..b41fe69 --- /dev/null +++ b/lib/strlen.c @@ -0,0 +1,32 @@ +/** +** @file strlen.c +** +** @author Numerous CSCI-452 classes +** +** @brief C implementations of common library functions +*/ + +#ifndef STRLEN_SRC_INC +#define STRLEN_SRC_INC + +#include + +#include + +/** +** strlen(str) - return length of a NUL-terminated string +** +** @param str The string to examine +** +** @return The length of the string, or 0 +*/ +uint32_t strlen( register const char *str ) { + register uint32_t len = 0; + + while( *str++ ) { + ++len; + } + + return( len ); +} +#endif -- cgit v1.2.3-freya