summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/strspn.c
blob: 2b3a4c1168b5b6fadf2b0cc475ac826f5d659337 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <sys/types.h>
#include <string.h>

size_t strspn(const char *s, const char *accept)
{
  size_t l=0;
  int a=1,i,al=strlen(accept);

  while((a)&&(*s))
  {
    for(a=i=0;(!a)&&(i<al);i++)
      if (*s==accept[i]) a=1;
    if (a) l++;
    s++;
  }
  return l;
}