compiler/clib: Rename IoErr2errno() to __arosc_ioerr2errno(); function is now defined...
[AROS.git] / compiler / clib / strspn.c
blob081fc5d5c90a34154d9177fe36eb92ba851557a2
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C function strspn().
6 */
8 /*****************************************************************************
10 NAME */
11 #include <string.h>
13 size_t strspn (
15 /* SYNOPSIS */
16 const char * str,
17 const char * accept)
19 /* FUNCTION
20 Calculates the length of the initial segment of str which consists
21 entirely of characters in accept.
23 INPUTS
24 str - The string to check.
25 accept - Characters which have to be in str.
27 RESULT
28 Length of the initial segment of str which contains only
29 characters from accept.
31 NOTES
33 EXAMPLE
34 char buffer[64];
36 strcpy (buffer, "Hello ");
38 // Returns 5
39 strspn (buffer, "Helo");
41 // Returns 0
42 strspn (buffer, "xyz");
44 BUGS
46 SEE ALSO
48 INTERNALS
50 ******************************************************************************/
52 size_t n = 0;
54 while (*str && strchr (accept, *str))
56 str ++;
57 n ++;
60 return n;
61 } /* strspn */