9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / strcoll.3c
blobca27166e65bda5154318e5df896807708162ec3b
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Copyright (c) 2001, The IEEE and The Open Group.  All Rights Reserved.
45 .\" Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved.
46 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
47 .\"
48 .TH STRCOLL 3C "Jun 23, 2014"
49 .SH NAME
50 strcoll, strcoll_l \- string collation
51 .SH SYNOPSIS
52 .LP
53 .nf
54 #include <string.h>
56 \fBint\fR \fBstrcoll\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR);
57 .fi
58 .LP
59 .nf
60 \fBint\fR \fBstrcoll_l\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR, \fBlocale_t\fR \fIloc\fR);
61 .fi
63 .SH DESCRIPTION
64 .LP
65 Both \fBstrcoll()\fR and \fBstrxfrm\fR(3C) provide for locale-specific string
66 sorting.  \fBstrcoll()\fR is intended for applications in which the number of
67 comparisons per string is small. When strings are to be compared a number of
68 times, \fBstrxfrm\fR(3C) is a more appropriate function because the
69 transformation process occurs only once.
70 .LP
71 The \fBstrcoll_l()\fR function behaves
72 identically to \fBstrcoll()\fR, except instead of operating in the current
73 locale, it operates in the locale specified by \fIloc\fR.
74 .LP
75 The \fBstrcoll()\fR function does not change the setting of \fBerrno\fR if
76 successful.
77 .LP
78 Since no return value is reserved to indicate an error, an application wishing
79 to check for error situations should set \fBerrno\fR to 0, then call
80 \fBstrcoll()\fR, then check \fBerrno\fR.
81 .SH RETURN VALUES
82 .LP
83 Upon successful completion, \fBstrcoll()\fR returns an integer greater than,
84 equal to, or less than zero in direct correlation to whether string \fIs1\fR is
85 greater than, equal to, or less than the string \fIs2\fR.  The comparison is
86 based on strings interpreted as appropriate to the locale
87 category \fBLC_COLLATE\fR (see \fBsetlocale\fR(3C)).
88 .LP
89 On error, \fBstrcoll()\fR may set \fBerrno\fR, but no return value is reserved
90 to indicate an error.
91 .SH ERRORS
92 .sp
93 .LP
94 The \fBstrcoll()\fR and \fBstrcoll_l()\fR functions may fail if:
95 .sp
96 .ne 2
97 .na
98 \fB\fBEINVAL\fR\fR
99 .ad
100 .RS 10n
101 The \fIs1\fR or \fIs2\fR arguments contain characters outside the domain of the
102 collating sequence.
104 .SH FILES
105 .IP \fB/usr/lib/locale/\fR\fIlocale\fR\fB/LC_COLLATE/*\fR
106 collation database for \fIlocale\fR
107 .SH ATTRIBUTES
109 See \fBattributes\fR(5) for descriptions of the following attributes:
111 box;
112 c | c
113 l | l .
114 ATTRIBUTE TYPE  ATTRIBUTE VALUE
116 CSI     Enabled
118 Interface Stability     Standard
120 MT-Level        MT-Safe
123 .SH SEE ALSO
126 \fBlocaledef\fR(1), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBstring\fR(3C),
127 \fBstrxfrm\fR(3C), \fBuselocale\fR(3C),
128 \fBwsxfrm\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)