Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / string / strcspn.c
blob8ac0bf10cff1bd4c779b3aae5578b2be7ed0ba46
1 /*
2 FUNCTION
3 <<strcspn>>---count characters not in string
5 INDEX
6 strcspn
8 SYNOPSIS
9 size_t strcspn(const char *<[s1]>, const char *<[s2]>);
11 DESCRIPTION
12 This function computes the length of the initial part of
13 the string pointed to by <[s1]> which consists entirely of
14 characters <[NOT]> from the string pointed to by <[s2]>
15 (excluding the terminating null character).
17 RETURNS
18 <<strcspn>> returns the length of the substring found.
20 PORTABILITY
21 <<strcspn>> is ANSI C.
23 <<strcspn>> requires no supporting OS subroutines.
26 #include <string.h>
28 size_t
29 strcspn (const char *s1,
30 const char *s2)
32 const char *s = s1;
33 const char *c;
35 while (*s1)
37 for (c = s2; *c; c++)
39 if (*s1 == *c)
40 goto end;
42 s1++;
44 end:
45 return s1 - s;