1 /* $NetBSD: multibyte.c,v 1.3 2008/07/12 19:20:03 dsl Exp $ */
4 * Ignore all multibyte sequences, removes all the citrus code.
5 * Probably only used by vfprintf() when parsing the format string.
6 * And possibly from libcurses if compiled with HAVE_WCHAR.
12 mbrtowc(wchar_t *wc
, const char *str
, size_t max_sz
, mbstate_t *ps
)
14 return str
== NULL
|| (*wc
= (unsigned char)*str
) == 0 ? 0 : 1;
18 wcrtomb(char *str
, wchar_t wc
, mbstate_t *ps
)
36 mbrlen(const char * __restrict p
, size_t l
, mbstate_t * __restrict v
)
39 for (i
= 0; i
< l
; i
++)
46 mbsinit(const mbstate_t *s
)
52 mbsrtowcs(wchar_t * __restrict pwcs
, const char ** __restrict s
, size_t n
,
53 mbstate_t * __restrict ps
)
59 for (p
= *s
, d
= pwcs
, count
= 0;
63 if (mbrtowc(d
, p
, 1, ps
) == 0)
70 wcsrtombs(char * __restrict s
, const wchar_t ** __restrict pwcs
, size_t n
,
71 mbstate_t * __restrict ps
)
77 for (p
= *pwcs
, d
= s
, count
= 0;
78 count
<= n
&& *p
!= 0;