--- wcstombs.3.orig 2009-11-09 15:05:25.000000000 -0800 +++ wcstombs.3 2009-11-09 15:05:26.000000000 -0800 @@ -37,7 +37,8 @@ .Dt WCSTOMBS 3 .Os .Sh NAME -.Nm wcstombs +.Nm wcstombs , +.Nm wcstombs_l .Nd convert a wide-character string to a character string .Sh LIBRARY .Lb libc @@ -45,28 +46,47 @@ .In stdlib.h .Ft size_t .Fo wcstombs -.Fa "char * restrict mbstring" "const wchar_t * restrict wcstring" -.Fa "size_t nbytes" +.Fa "char *restrict s" +.Fa "const wchar_t *restrict pwcs" +.Fa "size_t n" +.Fc +.In stdlib.h +.In xlocale.h +.Ft size_t +.Fo wcstombs_l +.Fa "char *restrict s" +.Fa "const wchar_t *restrict pwcs" +.Fa "size_t n" +.Fa "locale_t loc" .Fc .Sh DESCRIPTION The .Fn wcstombs function converts a wide character string -.Fa wcstring +.Fa pwcs into a multibyte character string, -.Fa mbstring , +.Fa s , beginning in the initial conversion state. Up to -.Fa nbytes +.Fa n bytes are stored in -.Fa mbstring . +.Fa s . Partial multibyte characters at the end of the string are not stored. -The multibyte character string is null terminated if there is room. +The multibyte character string is null terminated, if there is room. +.Pp +Although the +.Fn wcstombs +function uses the current locale, the +.Fn wcstombs_l +function may be passed a locale directly. See +.Xr xlocale 3 +for more information. .Sh RETURN VALUES The .Fn wcstombs function returns the number of bytes converted -(not including any terminating null), if successful, otherwise it returns +(not including any terminating null), if successful; +otherwise, it returns .Po Vt size_t Pc Ns \-1 . .Sh ERRORS The @@ -82,7 +102,8 @@ The conversion state is invalid. .Xr mbstowcs 3 , .Xr multibyte 3 , .Xr wcsrtombs 3 , -.Xr wctomb 3 +.Xr wctomb 3 , +.Xr xlocale 3 .Sh STANDARDS The .Fn wcstombs