From 781fd25bc9599e5405b16e7dc0ba7343b5c45c6e Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Wed, 24 Mar 2010 07:51:53 +0000 Subject: [PATCH] add strcspn implementation. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@533 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- libc/minilibc/string.c | 15 +++++++++++++++ libc/minilibc/string.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/libc/minilibc/string.c b/libc/minilibc/string.c index 179cd07b8..52726f2cb 100644 --- a/libc/minilibc/string.c +++ b/libc/minilibc/string.c @@ -564,6 +564,21 @@ size_t strspn(const char *s, const char *accept) return l; } +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