Subversion Repositories Kolibri OS

Rev

Rev 8793 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8793 Rev 9765
Line 1... Line 1...
1
/* strpbrk( const char *, const char * )
1
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2
 
-
 
3
   This file is part of the Public Domain C Library (PDCLib).
2
#include "unconst.h"
4
   Permission is granted to use, modify, and / or redistribute at will.
-
 
5
*/
-
 
6
 
-
 
7
#include 
3
#include 
Line 8... Line 4...
8
 
4
 
9
char * strpbrk( const char * s1, const char * s2 )
5
char* strpbrk(const char* s1, const char* s2)
10
{
-
 
11
    const char * p1 = s1;
6
{
12
    const char * p2;
-
 
13
 
-
 
14
    while ( *p1 )
-
 
15
    {
7
    const char* scanp;
16
        p2 = s2;
-
 
17
 
-
 
18
        while ( *p2 )
-
 
19
        {
-
 
20
            if ( *p1 == *p2++ )
-
 
21
            {
-
 
22
                return ( char * ) p1;
-
 
23
            }
-
 
Line -... Line 8...
-
 
8
    int c, sc;
-
 
9
 
24
        }
10
    while ((c = *s1++) != 0) {
-
 
11
        for (scanp = s2; (sc = *scanp++) != 0;)
25
 
12
            if (sc == c)
26
        ++p1;
-
 
27
    }
13
                return unconst(s1 - 1, char*);
28
 
14
    }
29
    return NULL;
15
    return 0;