]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/strcasecmp.3
fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
[thirdparty/man-pages.git] / man3 / strcasecmp.3
CommitLineData
fea681da
MK
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
fea681da
MK
24.\"
25.\" References consulted:
26.\" Linux libc source code
27.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28.\" 386BSD man pages
29.\" Modified Sat Jul 24 18:12:45 1993 by Rik Faith (faith@cs.unc.edu)
4b8c67d9 30.TH STRCASECMP 3 2017-09-15 "" "Linux Programmer's Manual"
fea681da
MK
31.SH NAME
32strcasecmp, strncasecmp \- compare two strings ignoring case
33.SH SYNOPSIS
34.nf
35.B #include <strings.h>
68e4db0a 36.PP
fea681da 37.BI "int strcasecmp(const char *" s1 ", const char *" s2 );
68e4db0a 38.PP
fea681da
MK
39.BI "int strncasecmp(const char *" s1 ", const char *" s2 ", size_t " n );
40.fi
41.SH DESCRIPTION
60a90ecd
MK
42The
43.BR strcasecmp ()
e20476d3 44function performs a byte-by-byte comparison of the strings
46d8df8e
MK
45.I s1
46and
47.IR s2 ,
48ignoring the case of the characters.
c13182ef 49It returns an integer
46d8df8e
MK
50less than, equal to, or greater than zero if
51.I s1
52is found,
53respectively, to be less than, to match, or be greater than
54.IR s2 .
fea681da 55.PP
60a90ecd
MK
56The
57.BR strncasecmp ()
2392242b
MK
58function is similar, except that it compares
59no more than
46d8df8e
MK
60.I n
61bytes of
0ee67404
MK
62.IR s1
63and
64.IR s2 .
47297adb 65.SH RETURN VALUE
60a90ecd
MK
66The
67.BR strcasecmp ()
68and
69.BR strncasecmp ()
70functions return
46d8df8e
MK
71an integer less than, equal to, or greater than zero if
72.I s1
2392242b 73is, after ignoring case, found to be
46d8df8e 74less than, to match, or be greater than
2392242b
MK
75.IR s2 ,
76respectively.
8a4afcf3
PH
77.SH ATTRIBUTES
78For an explanation of the terms used in this section, see
79.BR attributes (7).
80.TS
81allbox;
82lbw27 lb lb
83l l l.
84Interface Attribute Value
85T{
86.BR strcasecmp (),
87.BR strncasecmp ()
88T} Thread safety MT-Safe locale
89.TE
47297adb 90.SH CONFORMING TO
cad62ef6 914.4BSD, POSIX.1-2001, POSIX.1-2008.
ca24d850
MK
92.SH NOTES
93The
94.BR strcasecmp ()
95and
96.BR strncasecmp ()
97functions first appeared in 4.4BSD, where they were declared in
98.IR <string.h> .
99Thus, for reasons of historical compatibility, the glibc
100.I <string.h>
101header file also declares these functions, if the
102.B _DEFAULT_SOURCE
103(or, in glibc 2.19 and earlier,
104.BR _BSD_SOURCE )
105feature test macro is defined.
847e0d88 106.PP
e20476d3 107The POSIX.1-2008 standard says of these functions:
847e0d88 108.PP
e20476d3
MK
109.RS
110When the
111.B LC_CTYPE
112category of the locale being used is from the POSIX locale,
113these functions shall behave as if the strings had been converted
114to lowercase and then a byte comparison performed.
115Otherwise, the results are unspecified.
116.RE
47297adb 117.SH SEE ALSO
fea681da
MK
118.BR bcmp (3),
119.BR memcmp (3),
120.BR strcmp (3),
121.BR strcoll (3),
d095200e 122.BR string (3),
fea681da
MK
123.BR strncmp (3),
124.BR wcscasecmp (3),
125.BR wcsncasecmp (3)