.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" From @(#)multibyte.3 8.1 (Berkeley) 6/4/93
.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD: src/lib/libc/locale/mbstowcs.3,v 1.4 2004/07/05 06:36:36 ru Exp $
+.\" $FreeBSD: src/lib/libc/locale/mbstowcs.3,v 1.5 2007/01/09 00:28:00 imp Exp $
.\"
.Dd April 8, 2004
.Dt MBSTOWCS 3
.Os
.Sh NAME
-.Nm mbstowcs
+.Nm mbstowcs ,
+.Nm mbstowcs_l
.Nd convert a character string to a wide-character string
.Sh LIBRARY
.Lb libc
.In stdlib.h
.Ft size_t
.Fo mbstowcs
-.Fa "wchar_t * restrict wcstring" "const char * restrict mbstring"
-.Fa "size_t nwchars"
+.Fa "wchar_t *restrict pwcs"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fc
+.In stdlib.h
+.In xlocale.h
+.Ft size_t
+.Fo mbstowcs_l
+.Fa "wchar_t *restrict pwcs"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fa "locale_t loc"
.Fc
.Sh DESCRIPTION
The
.Fn mbstowcs
function converts a multibyte character string
-.Fa mbstring
-beginning in the initial conversion state
+.Fa s ,
+beginning in the initial conversion state,
into a wide character string
-.Fa wcstring .
+.Fa pwcs .
No more than
-.Fa nwchars
+.Fa n
wide characters are stored.
-A terminating null wide character is appended if there is room.
+A terminating null wide character is appended, if there is room.
+.Pp
+Although the
+.Fn mbstowcs
+function uses the current locale, the
+.Fn mbstowcs_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
.Sh RETURN VALUES
The
.Fn mbstowcs
.Sh SEE ALSO
.Xr mbsrtowcs 3 ,
.Xr mbtowc 3 ,
-.Xr multibyte 3
+.Xr multibyte 3 ,
+.Xr xlocale 3
.Sh STANDARDS
The
.Fn mbstowcs