X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fstring.c;h=bb1fae1af01510e163f96dd630627ec5d1f08125;hb=244c4fe7e6cf5ae78cbe6343fe7f9b6dfc29b11a;hp=195976978a4e369e78ee00263961af141d4c0ee5;hpb=a4fe009d3366b0a3e119713b0ecc7fc0070efdfa;p=libucw.git diff --git a/ucw/string.c b/ucw/string.c index 19597697..bb1fae1a 100644 --- a/ucw/string.c +++ b/ucw/string.c @@ -2,7 +2,7 @@ * UCW Library -- String Routines * * (c) 2006 Pavel Charvat - * (c) 2007--2008 Martin Mares + * (c) 2007--2012 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -10,8 +10,19 @@ #undef LOCAL_DEBUG -#include "ucw/lib.h" -#include "ucw/string.h" +#include +#include + +#ifdef CONFIG_DARWIN +uns +strnlen(const char *str, uns n) +{ + const char *end = str + n; + const char *c; + for (c = str; *c && c < end; c++); + return c - str; +} +#endif char * str_format_flags(char *dest, const char *fmt, uns flags)