Print this page
Add locale.h ref
Ensured various XPG7 stuff are declared properly in sys/stat.h (and cleanup)
New documentation for wcslen, wcsnlen, wcscasecmp (and friends), wcsdup.
Various other tweaks and markup improvements.
Note standards conformance for newlocale, convert to mdocml.

*** 1,6 **** - '\" te .\" .\" This file and its contents are supplied under the terms of the .\" Common Development and Distribution License ("CDDL"), version 1.0. .\" You may only use this file in accordance with the terms of version .\" 1.0 of the CDDL. --- 1,5 ----
*** 11,191 **** .\" .\" .\" Copyright (c) 2014 Joyent, Inc. All rights reserved. .\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" ! .TH NEWLOCALE 3C "Jun 23, 2014" ! .SH NAME ! duplocale, freelocale, newlocale \- create, duplicate, and destroy locale objects ! .SH SYNOPSIS ! .LP ! .nf ! #include <locale.h> ! ! \fBlocale_t\fR \fBnewlocale\fR(\fBint\fR \fIcategory_mask\fR, \fBconst char *\fR \fIlocale\fR, ! \fBlocale_t\fR \fIbase\fR); ! .fi ! .LP ! .nf ! \fBlocale_t\fR \fBduplocale\fR(\fBlocale_t\fR \fIloc\fR); ! .fi ! .LP ! .nf ! \fBvoid\fR \fBfreelocale\fR(\fBlocale_t\fR \fIloc\fR); ! .fi ! .SH DESCRIPTION ! .LP ! These functions manipulate locale objects that can be used ! .BR uselocale (3C) and functions that take arguments of type ! .BR locale_t . ! .LP ! The function ! .B newlocale() can be used to create a new locale object. It can also be used to modify an ! existing locale object, the new locale object will be a replacement for the modified locale object. To create a new locale, the argument ! .I base should be passed the special argument ! .RB ( locale_t )0. This will use a copy of the current global locale as a starting point. To modify an existing locale object, it should be passed in as the argument ! .IR base . The new locale object is constructed by taking the categories specified in ! .I category_mask from the locale specified by the string ! .IR locale , and filling in the remaining categories from the locale ! .IR base . When ! .B newlocale() returns, callers must no longer use ! .IR base ! and assume that ! .BR freelocale (3C) ! has been called on it. In addition to locales defined on the system, the following three locales may always be passed in as the string ! .IR locale : ! .TP ! "C" Specifies the traditional UNIX system behavior. ! .TP ! "POSIX" An alternate name fo the locale "C". ! .TP ! "" Indicates that the locale should be processed based in the values in the environment. See ! .BR setlocale (3C) and ! .BR environ (5) for more information. ! .LP The value of ! .I category_mask is a bitwise-inclusive or of the following macros which correspond to categories as defined in ! .BR locale (5) and ! .BR environ (5): ! .TP ! .B LC_CTYPE_MASK Character classification and case conversion. ! .TP ! .B LC_NUMERIC_MASK Numeric formatting. ! .TP ! .B LC_TIME_MASK Date and time formatting. ! .TP ! .B LC_COLLATE_MASK Collation order. ! .TP ! .B LC_MONETARY_MASK Monetary formatting. ! .TP ! .B LC_MESSAGES_MASK Formats of informative and diagnostic messages and interactive responses. ! .TP ! .B LC_ALL_MASK Mask of all categories. ! .LP ! The function ! .B duplocale() ! duplicates the locale object specified by ! .IR loc . If the locale object passed is ! .BR LC_GLOBAL_LOCALE , ! .B duplocale() creates a copy of the current global locale as defined through calls to ! .BR setlocale (3C). ! .LP ! The function ! .B freelocale() ! removes and releases all resources associated with the locale object ! .IR loc . Programs must not call ! .B freelocale() on ! .BR LC_GLOBAL_LOCALE . ! .SH RETURN VALUES ! .LP On success, the functions ! .B newlocale() and ! .B duplocale() return a new locale object that can be used with functions that take a ! .BR locale_t . Locale objects created this way should be freed with ! .BR freelocale() . On error, the functions ! .B newlocale() and ! .B duplocale() return ! .BR (locale_t) 0 and ! .B errno is set to indicate the error. The ! .B freelocale() function does not set ! .B errno. ! .SH ERRORS ! .LP The ! .B newlocale() and ! .B duplocale() functions will fail if: ! .TP ! .B ENOMEM Insufficient memory was available to create the locale object or to load the requested locale data. ! .LP The ! .B newlocale() function will fail if: ! .TP ! .B EINVAL An unknown bit is specified in ! .IR category_mask . ! .TP ! .B ENOENT Locale data was not found for a category specified in ! .SH ATTRIBUTES ! .TS ! box; ! c | c ! l | l . ! ATTRIBUTE TYPE ATTRIBUTE VALUE ! _ ! Interface Stability Standard ! _ ! MT-Level Safe ! .TE ! ! .SH SEE ALSO ! .BR locale (1), ! .BR setlocale (3C), ! .BR uselocale (3C), ! .BR environ (5), ! .BR locale (5) --- 10,195 ---- .\" .\" .\" Copyright (c) 2014 Joyent, Inc. All rights reserved. .\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" ! .Dd "Jul 23, 2014" ! .Dt NEWLOCALE 3C ! .Os ! .Sh NAME ! .Nm duplocale , ! .Nm freelocale , ! .Nm newlocale ! .Nd create, duplicate, and destroy locale objects ! .Sh SYNOPSIS ! .In locale.h ! . ! .Ft locale_t ! .Fo newlocale ! .Fa "int category_mask" ! .Fa "const char *locale" ! .Fa "locale_t base" ! .Fc ! . ! .Ft locale_t ! .Fo duplocale ! .Fa "locale_t loc" ! .Fc ! . ! .Ft void ! .Fo freelocale ! .Fa "locale_t loc" ! .Fc ! .Sh DESCRIPTION ! These functions manipulate locale objects that can be used with ! .Xr uselocale 3C and functions that take arguments of type ! .Vt locale_t . ! .Lp ! The ! .Fn newlocale ! function can be used to create a new locale object. It can also be used to modify an ! existing locale object; the new locale object will be a replacement for the modified locale object. To create a new locale, the argument ! .Fa base should be passed the special argument ! .Po Vt locale_t Pc 0. This will use a copy of the current global locale as a starting point. To modify an existing locale object, it should be passed in as the argument ! .Fa base . The new locale object is constructed by taking the categories specified in ! .Fa category_mask from the locale specified by the string ! .Fa locale , and filling in the remaining categories from the locale ! .Fa base . When ! .Fn newlocale returns, callers must no longer use ! .Fa base . ! They should assume that ! .Fn freelocale ! has been called on it. ! .Lp ! In addition to locales defined on the system, the following three locales may always be passed in as the string ! .Fa locale : ! .Bl -tag -offset indent -width Dq ! .It \\"C\\" Specifies the traditional UNIX system behavior. ! .It \\"POSIX\\" An alternate name fo the locale "C". ! .It \\"\\" Indicates that the locale should be processed based in the values in the environment. See ! .Xr setlocale 3C and ! .Xr environ 5 for more information. ! .El ! .Lp The value of ! .Fa category_mask is a bitwise-inclusive or of the following macros which correspond to categories as defined in ! .Xr locale 5 and ! .Xr environ 5 : ! .Bl -tag -offset indent -width Dv ! .It Dv LC_CTYPE_MASK Character classification and case conversion. ! .It Dv LC_NUMERIC_MASK Numeric formatting. ! .It Dv LC_TIME_MASK Date and time formatting. ! .It Dv LC_COLLATE_MASK Collation order. ! .It Dv LC_MONETARY_MASK Monetary formatting. ! .It Dv LC_MESSAGES_MASK Formats of informative and diagnostic messages and interactive responses. ! .It Dv LC_ALL_MASK Mask of all categories. ! .El ! .Lp ! The ! .Fn duplocale ! function duplicates the locale object specified by ! .Fa loc . If the locale object passed is ! .Dv LC_GLOBAL_LOCALE , ! .Fn duplocale creates a copy of the current global locale as defined through calls to ! .Xr setlocale 3C . ! .Lp ! The ! .Fn freelocale ! function removes and releases all resources associated with the locale object ! .Fa loc . Programs must not call ! .Fn freelocale on ! .Dv LC_GLOBAL_LOCALE . ! .Sh RETURN VALUES On success, the functions ! .Fn newlocale and ! .Fn duplocale return a new locale object that can be used with functions that take a ! .Vt locale_t . Locale objects created this way should be freed with ! .Fn freelocale . On error, the functions ! .Fn newlocale and ! .Fn duplocale return ! .Po Vt locale_t Pc 0 and ! .Va errno is set to indicate the error. The ! .Fn freelocale function does not set ! .Va errno . ! .Sh ERRORS The ! .Fn newlocale and ! .Fn duplocale functions will fail if: ! .Bl -tag -width Er ! .It Er ENOMEM Insufficient memory was available to create the locale object or to load the requested locale data. ! .El ! .Lp The ! .Fn newlocale function will fail if: ! .Bl -tag -width Er ! .It Er EINVAL An unknown bit is specified in ! .Fa category_mask . ! .It Er ENOENT Locale data was not found for a category specified in ! .Fa category_mask . ! .El ! .Sh INTERFACE STABILITY ! .Sy Standard . ! .Sh MT-LEVEL ! .Sy MT-Safe . ! .Sh SEE ALSO ! .Xr locale 1 , ! .Xr setlocale 3C , ! .Xr uselocale 3C , ! .Xr locale.h 3HEAD , ! .Xr environ 5 , ! .Xr locale 5 ! .Sh STANDARDS ! The ! .Fn newlocale , ! .Fn duplocale , ! and ! .Fn freelocale ! functions were introduced in ! .St -p1003.1-2008 .