]> pd.if.org Git - pdclib/blobdiff - functions/string/strcspn.c
Merged PDPCLIB and Therx code.
[pdclib] / functions / string / strcspn.c
index 80c620cb03c8749e514c7d81caefd9372ce5a01b..c2db7ab32abc73b2bac4349ae1b868417875720e 100644 (file)
@@ -6,3 +6,23 @@
 // ----------------------------------------------------------------------------
 
 size_t strcspn( const char * s1, const char * s2 ) { /* TODO */ };
+
+/* PDPC code - unreviewed
+{
+    const char *p1;
+    const char *p2;
+    
+    p1 = s1;
+    while (*p1 != '\0')
+    {
+        p2 = s2;
+        while (*p2 != '\0')
+        {
+            if (*p1 == *p2) return ((size_t)(p1 - s1));
+            p2++;
+        }
+        p1++;
+    }
+    return ((size_t)(p1 - s1));
+}
+*/