ref: f502e3ac97967156f93c249e72f3fae19c3bbeb5
parent: 1de8fdf8ff3054574467bee8d65655de45b5a933
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Feb 16 16:11:49 EST 2017
[libc] Add strlen()
--- a/libc/src/Makefile
+++ b/libc/src/Makefile
@@ -1,7 +1,7 @@
# See LICENSE file for copyright and license details.
.POSIX:
-LIBCOBJ = assert.o strcpy.o strcmp.o
+LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o
all: libc.a
--- /dev/null
+++ b/libc/src/strlen.c
@@ -1,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <string.h>
+
+size_t
+strlen(const char *s)
+{
+ const char *t;
+
+ for (t = s; *t; ++t)
+ /* nothing */;
+ return t - s;
+}