fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / string / strcspn.c
blobfe68b8f517db6dd06a16d719c4cc4fded29866bc
1 /*
2 FUNCTION
3 <<strcspn>>---count chars not in string
5 INDEX
6 strcspn
8 ANSI_SYNOPSIS
9 size_t strcspn(const char *<[s1]>, const char *<[s2]>);
11 TRAD_SYNOPSIS
12 size_t strcspn(<[s1]>, <[s2]>)
13 char *<[s1]>;
14 char *<[s2]>;
16 DESCRIPTION
17 This function computes the length of the initial part of
18 the string pointed to by <[s1]> which consists entirely of
19 characters <[NOT]> from the string pointed to by <[s2]>
20 (excluding the terminating null character).
22 RETURNS
23 <<strcspn>> returns the length of the substring found.
25 PORTABILITY
26 <<strcspn>> is ANSI C.
28 <<strcspn>> requires no supporting OS subroutines.
31 #include <string.h>
33 size_t
34 _DEFUN (strcspn, (s1, s2),
35 _CONST char *s1 _AND
36 _CONST char *s2)
38 _CONST char *s = s1;
39 _CONST char *c;
41 while (*s1)
43 for (c = s2; *c; c++)
45 if (*s1 == *c)
46 break;
48 if (*c)
49 break;
50 s1++;
53 return s1 - s;