xref: /freebsd-13.1/lib/libc/string/strcasecmp.3 (revision 58f0484f)
1*58f0484fSRodney W. Grimes.\" Copyright (c) 1990, 1991, 1993
2*58f0484fSRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3*58f0484fSRodney W. Grimes.\"
4*58f0484fSRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
5*58f0484fSRodney W. Grimes.\" Chris Torek.
6*58f0484fSRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
7*58f0484fSRodney W. Grimes.\" modification, are permitted provided that the following conditions
8*58f0484fSRodney W. Grimes.\" are met:
9*58f0484fSRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
10*58f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
11*58f0484fSRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
12*58f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
13*58f0484fSRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
14*58f0484fSRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
15*58f0484fSRodney W. Grimes.\"    must display the following acknowledgement:
16*58f0484fSRodney W. Grimes.\"	This product includes software developed by the University of
17*58f0484fSRodney W. Grimes.\"	California, Berkeley and its contributors.
18*58f0484fSRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
19*58f0484fSRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
20*58f0484fSRodney W. Grimes.\"    without specific prior written permission.
21*58f0484fSRodney W. Grimes.\"
22*58f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23*58f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*58f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*58f0484fSRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*58f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*58f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*58f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*58f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*58f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*58f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*58f0484fSRodney W. Grimes.\" SUCH DAMAGE.
33*58f0484fSRodney W. Grimes.\"
34*58f0484fSRodney W. Grimes.\"     @(#)strcasecmp.3	8.1 (Berkeley) 6/9/93
35*58f0484fSRodney W. Grimes.\"
36*58f0484fSRodney W. Grimes.Dd June 9, 1993
37*58f0484fSRodney W. Grimes.Dt STRCASECMP 3
38*58f0484fSRodney W. Grimes.Os
39*58f0484fSRodney W. Grimes.Sh NAME
40*58f0484fSRodney W. Grimes.Nm strcasecmp
41*58f0484fSRodney W. Grimes.Nd compare strings, ignoring case
42*58f0484fSRodney W. Grimes.Sh SYNOPSIS
43*58f0484fSRodney W. Grimes.Fd #include <string.h>
44*58f0484fSRodney W. Grimes.Ft int
45*58f0484fSRodney W. Grimes.Fn strcasecmp "const char *s1" "const char *s2"
46*58f0484fSRodney W. Grimes.Ft int
47*58f0484fSRodney W. Grimes.Fn strncasecmp "const char *s1" "const char *s2" "size_t len"
48*58f0484fSRodney W. Grimes.Sh DESCRIPTION
49*58f0484fSRodney W. GrimesThe
50*58f0484fSRodney W. Grimes.Fn strcasecmp
51*58f0484fSRodney W. Grimesand
52*58f0484fSRodney W. Grimes.Fn strncasecmp
53*58f0484fSRodney W. Grimesfunctions
54*58f0484fSRodney W. Grimescompare the null-terminated strings
55*58f0484fSRodney W. Grimes.Fa s1
56*58f0484fSRodney W. Grimesand
57*58f0484fSRodney W. Grimes.Fa s2
58*58f0484fSRodney W. Grimesand return an integer greater than, equal to, or less than 0,
59*58f0484fSRodney W. Grimesaccording as
60*58f0484fSRodney W. Grimes.Fa s1
61*58f0484fSRodney W. Grimesis lexicographically greater than, equal to, or less than
62*58f0484fSRodney W. Grimes.Fa s2
63*58f0484fSRodney W. Grimesafter translation of each corresponding character to lower-case.
64*58f0484fSRodney W. GrimesThe strings themselves are not modified.
65*58f0484fSRodney W. GrimesThe comparison is done using unsigned characters, so that
66*58f0484fSRodney W. Grimes.Sq Li \e200
67*58f0484fSRodney W. Grimesis greater than
68*58f0484fSRodney W. Grimes.Ql \e0 .
69*58f0484fSRodney W. Grimes.Pp
70*58f0484fSRodney W. GrimesThe
71*58f0484fSRodney W. Grimes.Fn strncasecmp
72*58f0484fSRodney W. Grimescompares at most
73*58f0484fSRodney W. Grimes.Fa len
74*58f0484fSRodney W. Grimescharacters.
75*58f0484fSRodney W. Grimes.Sh SEE ALSO
76*58f0484fSRodney W. Grimes.Xr bcmp 3 ,
77*58f0484fSRodney W. Grimes.Xr memcmp 3 ,
78*58f0484fSRodney W. Grimes.Xr strcmp 3 ,
79*58f0484fSRodney W. Grimes.Xr strcoll 3 ,
80*58f0484fSRodney W. Grimes.Xr strxfrm 3
81*58f0484fSRodney W. Grimes.Sh HISTORY
82*58f0484fSRodney W. GrimesThe
83*58f0484fSRodney W. Grimes.Fn strcasecmp
84*58f0484fSRodney W. Grimesand
85*58f0484fSRodney W. Grimes.Fn strncasecmp
86*58f0484fSRodney W. Grimesfunctions first appeared in 4.4BSD.
87