]> pd.if.org Git - pdclib/blobdiff - functions/string/strpbrk.c
Added search functions.
[pdclib] / functions / string / strpbrk.c
diff --git a/functions/string/strpbrk.c b/functions/string/strpbrk.c
new file mode 100644 (file)
index 0000000..8926cc8
--- /dev/null
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+/* Release $Name$ */
+
+/* strpbrk( const char *, const char * )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <string.h>
+
+char * strpbrk( const char * s1, const char * s2 )
+{
+    const char * p1 = s1;
+    const char * p2;
+    while ( *p1 )
+    {
+        p2 = s2;
+        while ( *p2 )
+        {
+            if ( *p1 == *p2++ )
+            {
+                return (char *) p1;
+            }
+        }
+        ++p1;
+    }
+    return NULL;
+}