[hackers] [scc] [libc] Add strlen() || Roberto E. Vargas Caballero
commit ff12208b737305ea29849e5ef65abcc37119229a
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Feb 16 21:11:49 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Feb 16 21:11:49 2017 +0100
[libc] Add strlen()
diff --git a/libc/src/Makefile b/libc/src/Makefile
index 78fc9ae..8a863fa 100644
--- a/libc/src/Makefile
+++ b/libc/src/Makefile
_AT_@ -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
diff --git a/libc/src/strlen.c b/libc/src/strlen.c
new file mode 100644
index 0000000..685ac62
--- /dev/null
+++ b/libc/src/strlen.c
_AT_@ -0,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;
+}
Received on Thu Feb 16 2017 - 21:24:56 CET
This archive was generated by hypermail 2.3.0
: Thu Feb 16 2017 - 21:36:38 CET