extern size_t xmbsrtowcs __P((wchar_t *, const char **, size_t, mbstate_t *));
extern size_t xdupmbstowcs __P((wchar_t **, char ***, const char *));
+extern size_t mbstrlen __P((const char *));
+
extern char *xstrchr __P((const char *, int));
#ifndef MB_INVALIDCH
#define MB_NULLWCH(x) ((x) == 0)
#endif
+#define MBSLEN(s) (((s) && (s)[0]) ? ((s)[1] ? mbstrlen (s) : 1) : 0)
+#define MB_STRLEN(s) ((MB_CUR_MAX > 1) ? MBSLEN (s) : STRLEN (s))
+
#else /* !HANDLE_MULTIBYTE */
#undef MB_LEN_MAX
#define MB_NULLWCH(x) (0)
#endif
+#define MB_STRLEN(s) (STRLEN(s))
+
#endif /* !HANDLE_MULTIBYTE */
/* Declare and initialize a multibyte state. Call must be terminated