mbrtowc.3.patch   [plain text]


--- _SB/Libc/locale/FreeBSD/mbrtowc.3	2004-11-25 11:38:18.000000000 -0800
+++ _SB/Libc/locale/FreeBSD/mbrtowc.3.edit	2006-06-29 11:10:29.000000000 -0700
@@ -28,7 +28,8 @@
 .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
@@ -36,16 +37,28 @@
 .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
@@ -65,14 +78,14 @@
 .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
@@ -86,6 +99,14 @@
 .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
@@ -131,7 +152,8 @@
 .Xr mbtowc 3 ,
 .Xr multibyte 3 ,
 .Xr setlocale 3 ,
-.Xr wcrtomb 3
+.Xr wcrtomb 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn mbrtowc