shithub: scc

Download patch

ref: 5689ef4e729aed4438f8c5c6a6626e3ea1df0073
parent: fe11ef11c059f7beeb45f605c4a706d4088c3168
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Feb 23 11:39:23 EST 2017

[tests] Add strpbr()

--- a/libc/src/Makefile
+++ b/libc/src/Makefile
@@ -3,7 +3,7 @@
 
 LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \
           strrchr.o strcat.o strncmp.o strncpy.o strncat.o strcoll.o \
-          strxfrm.o strtok.o strstr.o strspn.o strcspn.o \
+          strxfrm.o strtok.o strstr.o strspn.o strcspn.o strpbrk.o \
           memset.o memcpy.o memmove.o memcmp.o memchr.o \
           isalnum.o isalpha.o isascii.o isblank.o iscntrl.o isdigit.o \
           isgraph.o islower.o isprint.o ispunct.o isspace.o isupper.o \
--- /dev/null
+++ b/libc/src/strpbrk.c
@@ -1,0 +1,18 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <string.h>
+
+char *
+strpbrk(const char *s1, const char *s2)
+{
+	int c;
+	const char *p;
+
+	for (; c = *s1; ++s1) {
+		for (p = s2; *p && *p != c; ++p)
+			/* nothing */;
+		if (*p == c)
+			return s1;
+	}
+	return NULL;
+}