.Dt MBRTOWC 3
.Os
.Sh NAME
-.Nm mbrtowc
+.Nm mbrtowc ,
+.Nm mbrtowc_l
.Nd "convert a character to a wide-character code (restartable)"
.Sh LIBRARY
.Lb libc
.In wchar.h
.Ft size_t
.Fo mbrtowc
-.Fa "wchar_t * restrict pwc" "const char * restrict s" "size_t n"
-.Fa "mbstate_t * restrict ps"
+.Fa "wchar_t *restrict pwc"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fa "mbstate_t *restrict ps"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft size_t
+.Fo mbrtowc_l
+.Fa "wchar_t *restrict pwc"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fa "mbstate_t *restrict ps"
+.Fa "locale_t loc"
.Fc
.Sh DESCRIPTION
The
.Fn mbrtowc
function inspects at most
.Fa n
-bytes pointed to by
-.Fa s
+bytes, pointed to by
+.Fa s ,
to determine the number of bytes needed to complete the next multibyte
character.
If a character can be completed, and
.Fn mbrtowc
behaves as if
.Fa pwc
-was
+were
.Dv NULL ,
.Fa s
-was an empty string
-.Pq Qq
+were an empty string
+.Pq Qq ,
and
.Fa n
-was 1.
+were 1.
.Pp
The
.Vt mbstate_t
.Vt mbstate_t
object, which is initialized to the initial conversion state
at program startup.
+.Pp
+While the
+.Fn mbrtowc
+function uses the current locale, the
+.Fn mbrtowc_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
.Sh RETURN VALUES
The
.Fn mbrtowc
.Xr mbtowc 3 ,
.Xr multibyte 3 ,
.Xr setlocale 3 ,
-.Xr wcrtomb 3
+.Xr wcrtomb 3 ,
+.Xr xlocale 3
.Sh STANDARDS
The
.Fn mbrtowc