#include <stdio.h>
-#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
-
uns
stk_array_len(char **s, uns cnt)
{
#include <alloca.h>
#include <string.h>
#include <stdio.h>
-
-#ifdef CONFIG_DARWIN
-uns strnlen(const char *str, uns n);
-#endif
+#include "ucw/string.h"
#define stk_strdup(s) ({ const char *_s=(s); uns _l=strlen(_s)+1; char *_x=alloca(_l); memcpy(_x, _s, _l); _x; })
#define stk_strndup(s,n) ({ const char *_s=(s); uns _l=strnlen(_s,(n)); char *_x=alloca(_l+1); memcpy(_x, _s, _l); _x[_l]=0; _x; })
#include "ucw/lib.h"
#include "ucw/string.h"
+#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)
{
/* string.c */
+#ifdef CONFIG_DARWIN
+uns strnlen(const char *str, uns n);
+#endif
+
char *str_format_flags(char *dest, const char *fmt, uns flags);
uns str_count_char(const char *str, uns chr);