diff options
Diffstat (limited to 'apps/plugins/lua/strcspn.c')
-rw-r--r-- | apps/plugins/lua/strcspn.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/plugins/lua/strcspn.c b/apps/plugins/lua/strcspn.c new file mode 100644 index 0000000000..7af6f693eb --- /dev/null +++ b/apps/plugins/lua/strcspn.c | |||
@@ -0,0 +1,16 @@ | |||
1 | #include "rocklibc.h" | ||
2 | |||
3 | size_t strcspn(const char *s, const char *reject) | ||
4 | { | ||
5 | size_t l=0; | ||
6 | int a=1,i,al=strlen(reject); | ||
7 | |||
8 | while((a)&&(*s)) | ||
9 | { | ||
10 | for(i=0;(a)&&(i<al);i++) | ||
11 | if (*s==reject[i]) a=0; | ||
12 | if (a) l++; | ||
13 | s++; | ||
14 | } | ||
15 | return l; | ||
16 | } | ||