summaryrefslogtreecommitdiff
path: root/lib/strlen.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-03-25 17:36:52 -0400
committerFreya Murphy <freya@freyacat.org>2025-03-25 17:38:22 -0400
commit6af21e6a4f2251e71353562d5df7f376fdffc270 (patch)
treede20c7afc9878422c81e34f30c6b010075e9e69a /lib/strlen.c
downloadcomus-6af21e6a4f2251e71353562d5df7f376fdffc270.tar.gz
comus-6af21e6a4f2251e71353562d5df7f376fdffc270.tar.bz2
comus-6af21e6a4f2251e71353562d5df7f376fdffc270.zip
initial checkout from wrc
Diffstat (limited to 'lib/strlen.c')
-rw-r--r--lib/strlen.c32
1 files changed, 32 insertions, 0 deletions
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 <common.h>
+
+#include <lib.h>
+
+/**
+** 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