summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/strcspn.c
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-05-21 19:01:41 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-05-21 19:01:41 +0000
commitcf87597226f5d6b269f1f2c4d6f402aa1eccb852 (patch)
tree4ba1f3ae53b3bd9cae0e2c6c4dd57836b43a5ece /apps/plugins/lua/strcspn.c
parentc483efadc63eaed35b5fb5e4e02c2282daf32470 (diff)
downloadrockbox-cf87597226f5d6b269f1f2c4d6f402aa1eccb852.tar.gz
rockbox-cf87597226f5d6b269f1f2c4d6f402aa1eccb852.zip
Commit FS#9174: Lua scripting language by Dan Everton
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21020 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lua/strcspn.c')
-rw-r--r--apps/plugins/lua/strcspn.c16
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
3size_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}