]> git.saurik.com Git - apple/libc.git/blob - string/FreeBSD/strcasecmp.3
Libc-1081.1.3.tar.gz
[apple/libc.git] / string / FreeBSD / strcasecmp.3
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.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 4. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" SUCH DAMAGE.
29 .\"
30 .\" @(#)strcasecmp.3 8.1 (Berkeley) 6/9/93
31 .\" $FreeBSD: src/lib/libc/string/strcasecmp.3,v 1.13 2009/04/07 13:42:53 trasz Exp $
32 .\"
33 .Dd June 9, 1993
34 .Dt STRCASECMP 3
35 .Os
36 .Sh NAME
37 .Nm strcasecmp ,
38 .Nm strcasecmp_l ,
39 .Nm strncasecmp ,
40 .Nm strncasecmp_l
41 .Nd compare strings, ignoring case
42 .Sh LIBRARY
43 .Lb libc
44 .Sh SYNOPSIS
45 .In strings.h
46 .Ft int
47 .Fo strcasecmp
48 .Fa "const char *s1"
49 .Fa "const char *s2"
50 .Fc
51 .Ft int
52 .Fo strncasecmp
53 .Fa "const char *s1"
54 .Fa "const char *s2"
55 .Fa "size_t n"
56 .Fc
57 .In strings.h
58 .In xlocale.h
59 .Ft int
60 .Fo strcasecmp_l
61 .Fa "const char *s1"
62 .Fa "const char *s2"
63 .Fa "locale_t loc"
64 .Fc
65 .Ft int
66 .Fo strncasecmp_l
67 .Fa "const char *s1"
68 .Fa "const char *s2"
69 .Fa "size_t n"
70 .Fa "locale_t loc"
71 .Fc
72 .Sh DESCRIPTION
73 The
74 .Fn strcasecmp
75 and
76 .Fn strncasecmp
77 functions
78 compare the null-terminated strings
79 .Fa s1
80 and
81 .Fa s2 .
82 .Pp
83 The
84 .Fn strncasecmp
85 compares at most
86 .Fa n
87 characters.
88 .Pp
89 Although the
90 .Fn strcasecmp
91 and
92 .Fn strncasecmp
93 functions use the current locale, the
94 .Fn strcasecmp_l
95 and
96 .Fn strncasecmp_l
97 functions may be passed locales directly. See
98 .Xr xlocale 3
99 for more information.
100 .Sh RETURN VALUES
101 The
102 .Fn strcasecmp
103 and
104 .Fn strncasecmp
105 return an integer greater than, equal to, or less than 0,
106 according as
107 .Fa s1
108 is lexicographically greater than, equal to, or less than
109 .Fa s2
110 after translation of each corresponding character to lower-case.
111 The strings themselves are not modified.
112 The comparison is done using unsigned characters, so that
113 .Sq Li \e200
114 is greater than
115 .Ql \e0 .
116 .Sh SEE ALSO
117 .Xr bcmp 3 ,
118 .Xr memcmp 3 ,
119 .Xr strcmp 3 ,
120 .Xr strcoll 3 ,
121 .Xr strxfrm 3 ,
122 .Xr tolower 3 ,
123 .Xr xlocale 3
124 .Sh HISTORY
125 The
126 .Fn strcasecmp
127 and
128 .Fn strncasecmp
129 functions first appeared in
130 .Bx 4.4 .
131 Their prototypes existed previously in
132 .In string.h
133 before they were moved to
134 .In strings.h
135 for
136 .St -p1003.1-2001
137 compliance.