[hackers] [scc] [libc] Add strchr() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 16 Feb 2017 21:24:56 +0100 (CET)

commit 3f51e82f5bad60cd837488bd5e1a8badd3441835
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Feb 16 21:17:30 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Feb 16 21:17:30 2017 +0100

    [libc] Add strchr()

diff --git a/libc/src/Makefile b/libc/src/Makefile
index 8a863fa..613cd0b 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 strlen.o
+LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o
 
 all: libc.a
 
diff --git a/libc/src/strchr.c b/libc/src/strchr.c
new file mode 100644
index 0000000..16aa47c
--- /dev/null
+++ b/libc/src/strchr.c
_AT_@ -0,0 +1,11 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <string.h>
+
+char *
+strchr(const char *s, int c)
+{
+ while (*s && *s != c)
+ ++s;
+ return (*s) ? (char *) s : NULL;
+}
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:44 CET