xref: /titanic_50/usr/src/man/man3c/wcscasecmp.3c (revision 4812581794004eff0af2b765b832403b30bf64ab)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\"
12.\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
13.\"
14.Dd "Nov 4, 2014"
15.Dt WCSCASECMP 3C
16.Os
17.Sh NAME
18.Nm wcscasecmp ,
19.Nm wcscasecmp_l ,
20.Nm wcsncasecmp ,
21.Nm wcsncasecmp_l
22.Nd case-insensitive wide-character string comparison
23.Sh SYNOPSIS
24.In wchar.h
25.
26.Ft int
27.Fo wcscasecmp
28.Fa "const wchar_t *ws1"
29.Fa "const wchar_t *ws2"
30.Fc
31.
32.Ft int
33.Fo wcscasecmp_l
34.Fa "const wchar_t *ws1"
35.Fa "const wchar_t *ws2"
36.Fa "locale_t loc"
37.Fc
38.
39.Ft int
40.Fo wcsncasecmp
41.Fa "const wchar_t *ws1"
42.Fa "const wchar_t *ws2"
43.Fa "size_t n"
44.Fc
45.
46.Ft int
47.Fo wcsncasecmp_l
48.Fa "const wchar_t *ws1"
49.Fa "const wchar_t *ws2"
50.Fa "size_t n"
51.Fa "locale_t loc"
52.Fc
53.Sh DESCRIPTION
54These functions perform case-insensitive comparison of wide-character
55strings
56.Fa ws1
57and
58.Fa ws2 .
59Pairs of wide-characters from each of
60.Fa ws1
61and
62.Fa ws2
63are compared consecutively, ignoring differences in case (if the
64.\"POSIX\." locale upper case characters are treated as lower case).  If
65the two values are different, the comparision stops and either
66a negative value is returned if the character from
67.Fa ws1
68is less than that from
69.Fa ws2 ,
70or a positive is returned if the character from
71.Fa ws1
72is greater than that from
73.Fa ws2 .
74The comparison also stops if both characters are null wide-characters,
75or, in the case of
76.Fn wcsncasecmp
77and
78.Fn wcsncasecmp_l ,
79after
80.Fa n
81comparisons have been made without finding a difference.  In either of
82these two cases, 0 is returned.
83.Lp
84The
85.Fn wcscasecmp
86and
87.Fn wcsncasecmp
88functions use the
89.Dv LC_CTYPE
90category of the current locale to determine case.  The
91.Fn wcscasecmp_l
92and
93.Fn wcsncasecmp_l
94functions use the
95.Dv LC_CTYPE
96category of the locale pointed to by
97.Fa loc
98to determine case.
99.Lp
100Passing
101.Dv LC_GLOBAL_LOCALE
102for
103.Fa loc
104results in undefined behavior.
105.Lp
106The
107.Fn wcscasecmp ,
108.Fn wcsncasecmp ,
109.Fn wcscasecmp_l ,
110and
111.Fn wcsncasecmp_l
112functions are the wide-character equivalents of the
113.Fn strcasecmp ,
114.Fn strncasecmp ,
115.Fn strcasemp_l ,
116and
117.Fn strncasecmp_l
118functions, respectively.
119.Sh RETURN VALUES
120These functions return a negative value if, ignoring case,
121.Fa ws1
122is less than
123.Fa ws1 ,
124or a positive value  if
125.Fa ws1
126is greater than
127.Fa ws2 ,
128or 0 if the both
129.Fa ws1
130and
131.Fa ws2
132are the same.
133.Sh ERRORS
134None.
135.Sh INTERFACE STABILITY
136.Sy Standard .
137.Sh MT-LEVEL
138.Sy MT-Safe .
139.Sh SEE ALSO
140.Xr newlocale 3C ,
141.Xr setlocale 3C ,
142.Xr strcasecmp 3C ,
143.Xr strcasecmp_l 3C ,
144.Xr strncasecmp 3C ,
145.Xr strncasecmp_l 3C ,
146.Xr uselocale 3C ,
147.Xr wchar.h 3HEAD ,
148.Xr locale 5 ,
149.Xr standards 5
150.Sh STANDARDS
151The
152.Fn wcscasecmp ,
153.Fn wcsncasecmp ,
154.Fn wcscasecmp_l ,
155and
156.Fn wcsncasecmp_l
157functions were introduced in
158.St -p1003.1-2008 .
159