1 #include <reent.h>
2 #include <wchar.h>
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <errno.h>
6 
7 size_t
mbrlen(const char * s,size_t n,mbstate_t * ps)8 mbrlen(const char *s, size_t n, mbstate_t *ps)
9 {
10 #ifdef MB_CAPABLE
11   if (ps == NULL)
12     {
13       _REENT_CHECK_MISC(_REENT);
14       ps = &(_REENT_MBRLEN_STATE(_REENT));
15     }
16 #endif
17 
18   return mbrtowc(NULL, s, n, ps);
19 }
20