repo.or.cz
/
haiku.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
libroot_debug: Merge guarded heap into libroot_debug.
[haiku.git]
/
src
/
system
/
libroot
/
posix
/
string
/
strspn.c
blob
c13e7045d0522f2d08068b74efb30cefe983594c
1
/*
2
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
3
** Distributed under the terms of the NewOS License.
4
*/
5
6
#include <sys/types.h>
7
#include <string.h>
8
9
10
size_t
11
strspn
(
char const
*
s
,
char const
*
accept
)
12
{
13
const char
*
p
;
14
const char
*
a
;
15
size_t
count
=
0
;
16
17
for
(
p
=
s
; *
p
!=
'\0'
; ++
p
) {
18
for
(
a
=
accept
; *
a
!=
'\0'
; ++
a
) {
19
if
(*
p
== *
a
)
20
break
;
21
}
22
if
(*
a
==
'\0'
)
23
return
count
;
24
++
count
;
25
}
26
27
return
count
;
28
}