[hackers] [scc] [tests] Add strpbr() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 23 Feb 2017 16:39:37 +0100 (CET)

commit 23dd58a0a616e7695b58073349762e104cf604c2
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Feb 23 16:39:23 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
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
_AT_@ -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
_AT_@ -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;
+}
Received on Thu Feb 23 2017 - 16:39:37 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 23 2017 - 16:48:18 CET