Print this page
Garrett's man page edits.
*** 9,48 ****
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" Copyright (c) 2014 Joyent, Inc. All rights reserved.
.\"
! .TH NEWLOCALE 3C "Jun 11, 2014"
!
.SH NAME
-
duplocale, freelocale, newlocale \- create, duplicate, and destroy locale objects
-
.SH SYNOPSIS
-
.LP
.nf
#include <locale.h>
! .BI "locale_t newlocale(int " category_mask, " const char *" locale,
! .BI " locale_t " base );
.LP
! .BI "locale_t duplocale(locale_t " loc );
.LP
! .BI "void freelocale(locale_t " loc );
!
.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
! .I 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
--- 9,48 ----
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" 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
*** 55,185 ****
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 :
!
! .sp
! .ne 2
! .na
"C"
- .ad
- .sp .6
- .RS 4n
Specifies the traditional UNIX system behavior.
! .RE
!
! .sp
! .ne 2
! .na
"POSIX"
- .ad
- .sp .6
- .RS 4n
An alternate name fo the locale "C".
! .RE
!
! .sp
! .ne 2
! .na
""
- .ad
- .sp .6
- .RS 4n
Indicates that the locale should be processed based in the values in the
environment. See
! .BR setlocale "(3C) and " environ (5)
for more information.
- .RE
-
-
-
.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 " environ" (5):
!
! .sp
! .ne 2
! .na
! LC_CTYPE_MASK
! .ad
! .sp .6
! .RS 4n
Character classification and case conversion.
! .RE
!
! .sp
! .ne 2
! .na
! LC_NUMERIC_MASK
! .ad
! .sp .6
! .RS 4n
Numeric formatting.
! .RE
!
! .sp
! .ne 2
! .na
! LC_TIME_MASK
! .ad
! .sp .6
! .RS 4n
Date and time formatting.
! .RE
!
! .sp
! .ne 2
! .na
! LC_COLLATE_MASK
! .ad
! .sp .6
! .RS 4n
Collation order.
! .RE
!
! .sp
! .ne 2
! .na
! LC_MONETARY_MASK
! .ad
! .sp .6
! .RS 4n
! Monetary formating.
! .RE
!
! .sp
! .ne 2
! .na
! LC_MESSAGES_MASK
! .ad
! .sp .6
! .RS 4n
Formats of informative and diagnostic messages and interactive responses.
! .RE
!
! .sp
! .ne 2
! .na
! LC_ALL_MASK
! .ad
! .sp .6
! .RS 4n
! Instructs that all the categories defined above, be used.
! .RE
!
.LP
The function
.B duplocale()
duplicates the locale object specified by
.IR loc .
--- 55,115 ----
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 .
*** 186,208 ****
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
!
On success, the functions
.B newlocale()
and
.B duplocale()
return a new locale object that can be used with functions that take a
--- 116,136 ----
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
*** 219,271 ****
.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:
! .sp
! .ne 2
! .na
.B ENOMEM
- .ad
- .RS 10n
Insufficient memory was available to create the locale object or to load the
requested locale data.
- .RE
-
.LP
The
.B newlocale()
function will fail if:
! .sp
! .ne 2
! .na
.B EINVAL
- .ad
- .RS 10n
An unknown bit is specified in
.IR category_mask .
! .RE
! .sp
! .ne 2
! .na
.B ENOENT
- .ad
- .RS 10n
Locale data was not found for a category specified in
- .IR category_mask .
- .RE
-
.SH ATTRIBUTES
- .sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
--- 147,179 ----
.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