summaryrefslogtreecommitdiffstats
path: root/apps/plugins/lua/strcspn.c
blob: 0a19eaebf25a692d92789dd12fc93872c21f4a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "rocklibc.h"

#undef strcspn
size_t strcspn(const char *s, const char *reject)
{
  size_t l=0;
  int a=1,i,al=strlen(reject);

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