Use the detected no-builtin flag. (NicJA)
[AROS.git] / compiler / stdc / strcspn.c
blob7f740a5bc27af6acd1d4f64c8dbdd77871816fb9
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function strcspn().
6 */
8 /*****************************************************************************
10 NAME */
11 #include <string.h>
13 size_t strcspn (
15 /* SYNOPSIS */
16 const char * str,
17 const char * reject)
19 /* FUNCTION
20 Calculates the length of the initial segment of str which consists
21 entirely of characters not in reject.
23 INPUTS
24 str - The string to check.
25 reject - Characters which must not be in str.
27 RESULT
28 Length of the initial segment of str which doesn't contain any
29 characters from reject.
31 NOTES
33 EXAMPLE
34 char buffer[64];
36 strcpy (buffer, "Hello ");
38 // Returns 5
39 strcspn (buffer, " ");
41 // Returns 0
42 strcspn (buffer, "H");
44 BUGS
46 SEE ALSO
48 INTERNALS
50 ******************************************************************************/
52 size_t n = 0; /* Must set this to zero */
54 while (*str && !strchr (reject, *str))
56 str ++;
57 n ++;
60 return n;
61 } /* strcspn */