shithub: scc

Download patch

ref: 4ee9ebc661402b87d297b15bfabf1105ba6cc598
parent: f502e3ac97967156f93c249e72f3fae19c3bbeb5
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Feb 16 16:17:30 EST 2017

[libc] Add strchr()

--- 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 strlen.o
+LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o
 
 all: libc.a
 
--- /dev/null
+++ b/libc/src/strchr.c
@@ -1,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;
+}