headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / libroot / posix / string / strspn.c
blobc13e7045d0522f2d08068b74efb30cefe983594c
1 /*
2 ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
6 #include <sys/types.h>
7 #include <string.h>
10 size_t
11 strspn(char const *s, char const *accept)
13 const char *p;
14 const char *a;
15 size_t count = 0;
17 for (p = s; *p != '\0'; ++p) {
18 for (a = accept; *a != '\0'; ++a) {
19 if (*p == *a)
20 break;
22 if (*a == '\0')
23 return count;
24 ++count;
27 return count;