summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/strspn.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/strspn.c')
-rw-r--r--apps/plugins/lua/strspn.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/plugins/lua/strspn.c b/apps/plugins/lua/strspn.c
new file mode 100644
index 0000000000..e95500a1dc
--- /dev/null
+++ b/apps/plugins/lua/strspn.c
@@ -0,0 +1,19 @@
1#include "rocklibc.h"
2
3#undef strspn
4
5size_t strspn(const char *s, const char *accept)
6{
7 size_t count;
8 for (count = 0; *s != 0; s++, count++) {
9 const char *ac;
10 for (ac = accept; *ac != 0; ac++) {
11 if (*ac == *s)
12 break;
13 }
14 if (*ac == 0) /* no acceptable char found */
15 break;
16 }
17 return count;
18}
19