]> pd.if.org Git - pdclib/blob - functions/string/strcspn.c
Merged PDPCLIB and Therx code.
[pdclib] / functions / string / strcspn.c
1 // ----------------------------------------------------------------------------
2 // $Id$
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
7
8 size_t strcspn( const char * s1, const char * s2 ) { /* TODO */ };
9
10 /* PDPC code - unreviewed
11 {
12     const char *p1;
13     const char *p2;
14     
15     p1 = s1;
16     while (*p1 != '\0')
17     {
18         p2 = s2;
19         while (*p2 != '\0')
20         {
21             if (*p1 == *p2) return ((size_t)(p1 - s1));
22             p2++;
23         }
24         p1++;
25     }
26     return ((size_t)(p1 - s1));
27 }
28 */