diff options
Diffstat (limited to 'apps/plugins/lua/strcspn.c')
| -rw-r--r-- | apps/plugins/lua/strcspn.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/plugins/lua/strcspn.c b/apps/plugins/lua/strcspn.c new file mode 100644 index 0000000..0a19eae --- /dev/null +++ b/apps/plugins/lua/strcspn.c @@ -0,0 +1,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; +} |