OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [string/] [strcspn.c] - Blame information for rev 1775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* strcspn.c */
2
 
3
/* from Schumacher's Atari library, improved */
4
 
5
#include <string.h>
6
 
7
size_t strcspn(string, set)
8
register char *string;
9
char *set;
10
/*
11
 *      Return the length of the sub-string of <string> that consists
12
 *      entirely of characters not found in <set>.  The terminating '\0'
13
 *      in <set> is not considered part of the match set.  If the first
14
 *      character if <string> is in <set>, 0 is returned.
15
 */
16
{
17
    register char *setptr;
18
    char *start;
19
 
20
    start = string;
21
    while (*string)
22
    {
23
        setptr = set;
24
        do
25
            if (*setptr == *string)
26
                goto break2;
27
        while (*setptr++);
28
        ++string;
29
    }
30
break2:
31
    return string - start;
32
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.