commit 23dd58a0a616e7695b58073349762e104cf604c2
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Thu Feb 23 16:39:23 2017 +0100
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Thu Feb 23 16:39:23 2017 +0100

    [tests] Add strpbr()

diff --git a/libc/src/Makefile b/libc/src/Makefile
index 5d5484c..b9b1d4f 100644
--- 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 \
diff --git a/libc/src/strpbrk.c b/libc/src/strpbrk.c
new file mode 100644
index 0000000..f567c44
--- /dev/null
+++ b/libc/src/strpbrk.c
@@ -0,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;
+}

Reply via email to