X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstring%2Fstrcspn.c;h=c2db7ab32abc73b2bac4349ae1b868417875720e;hp=80c620cb03c8749e514c7d81caefd9372ce5a01b;hb=0a5395faab237ba9008352b0f4bee9659bbd3d5f;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec diff --git a/functions/string/strcspn.c b/functions/string/strcspn.c index 80c620c..c2db7ab 100644 --- a/functions/string/strcspn.c +++ b/functions/string/strcspn.c @@ -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)); +} +*/