xref: /dragonfly/lib/libc/string/wcscoll.3 (revision 9348a738)
1.\" Copyright (c) 1990, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)strcoll.3	8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: head/lib/libc/string/wcscoll.3 251069 2013-05-28 20:57:40Z emaste $
34.\"
35.Dd July 26, 2015
36.Dt WCSCOLL 3
37.Os
38.Sh NAME
39.Nm wcscoll ,
40.Nm wcscoll_l
41.Nd compare wide strings according to current collation
42.Sh LIBRARY
43.Lb libc
44.Sh SYNOPSIS
45.In wchar.h
46.Ft int
47.Fn wcscoll "const wchar_t *s1" "const wchar_t *s2"
48.Ft int
49.Fn wcscoll_l "const wchar_t *s1" "const wchar_t *s2" "locale_t locale"
50.Sh DESCRIPTION
51The
52.Fn wcscoll
53function compares the null-terminated strings
54.Fa s1
55and
56.Fa s2
57according to the current locale collation order.
58In the
59.Dq Li C
60locale,
61.Fn wcscoll
62is equivalent to
63.Fn wcscmp .
64.Pp
65The
66.Fn wcscoll_l
67function is identical to
68.Fn wcscoll
69but takes an explicit
70.Fa locale
71argument, whereas
72.Fn wcscoll
73uses the current global or per-thread locale.
74.Sh RETURN VALUES
75The
76.Fn wcscoll
77and
78.Fn wcscoll_l
79functions return an integer greater than, equal to, or less than 0,
80if
81.Fa s1
82is greater than, equal to, or less than
83.Fa s2 .
84.Pp
85No return value is reserved to indicate errors;
86callers should set
87.Va errno
88to 0 before calling
89.Fn wcscoll .
90If it is non-zero upon return from
91.Fn wcscoll ,
92an error has occurred.
93.Sh ERRORS
94The
95.Fn wcscoll
96and
97.Fn wcscoll_l
98functions will fail if:
99.Bl -tag -width Er
100.It Bq Er EILSEQ
101An invalid wide character code was specified.
102.It Bq Er ENOMEM
103Cannot allocate enough memory for temporary buffers.
104.El
105.Sh SEE ALSO
106.Xr setlocale 3 ,
107.Xr strcoll 3 ,
108.Xr wcscmp 3 ,
109.Xr wcsxfrm 3
110.Sh STANDARDS
111The
112.Fn wcscoll
113function
114conforms to
115.St -isoC-99 .
116+The
117+.Fn wcscoll_l
118+function conforms to
119+.St -p1003.1-2008 .
120.Sh BUGS
121The current implementation of
122.Fn wcscoll
123and
124.Fn wcscoll_l
125only works in single-byte
126.Dv LC_CTYPE
127locales, and falls back to using
128.Fn wcscmp
129in locales with extended character sets.
130