]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/strcasecmp.3
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man3 / strcasecmp.3
CommitLineData
fea681da
MK
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
4.\"
5.\" References consulted:
6.\" Linux libc source code
7.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
8.\" 386BSD man pages
9.\" Modified Sat Jul 24 18:12:45 1993 by Rik Faith (faith@cs.unc.edu)
4c1c5274 10.TH strcasecmp 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
11.SH NAME
12strcasecmp, strncasecmp \- compare two strings ignoring case
0781f22b
AC
13.SH LIBRARY
14Standard C library
8fc3b2cf 15.RI ( libc ", " \-lc )
fea681da
MK
16.SH SYNOPSIS
17.nf
18.B #include <strings.h>
68e4db0a 19.PP
fea681da 20.BI "int strcasecmp(const char *" s1 ", const char *" s2 );
fea681da
MK
21.BI "int strncasecmp(const char *" s1 ", const char *" s2 ", size_t " n );
22.fi
23.SH DESCRIPTION
60a90ecd
MK
24The
25.BR strcasecmp ()
e20476d3 26function performs a byte-by-byte comparison of the strings
46d8df8e
MK
27.I s1
28and
29.IR s2 ,
30ignoring the case of the characters.
c13182ef 31It returns an integer
46d8df8e
MK
32less than, equal to, or greater than zero if
33.I s1
34is found,
35respectively, to be less than, to match, or be greater than
36.IR s2 .
fea681da 37.PP
60a90ecd
MK
38The
39.BR strncasecmp ()
2392242b
MK
40function is similar, except that it compares
41no more than
46d8df8e
MK
42.I n
43bytes of
1ae6b2c7 44.I s1
0ee67404
MK
45and
46.IR s2 .
47297adb 47.SH RETURN VALUE
60a90ecd
MK
48The
49.BR strcasecmp ()
50and
51.BR strncasecmp ()
52functions return
46d8df8e
MK
53an integer less than, equal to, or greater than zero if
54.I s1
2392242b 55is, after ignoring case, found to be
46d8df8e 56less than, to match, or be greater than
2392242b
MK
57.IR s2 ,
58respectively.
8a4afcf3
PH
59.SH ATTRIBUTES
60For an explanation of the terms used in this section, see
61.BR attributes (7).
c466875e
MK
62.ad l
63.nh
8a4afcf3
PH
64.TS
65allbox;
c466875e 66lbx lb lb
8a4afcf3
PH
67l l l.
68Interface Attribute Value
69T{
70.BR strcasecmp (),
71.BR strncasecmp ()
72T} Thread safety MT-Safe locale
73.TE
c466875e
MK
74.hy
75.ad
76.sp 1
3113c7f3 77.SH STANDARDS
cad62ef6 784.4BSD, POSIX.1-2001, POSIX.1-2008.
ca24d850
MK
79.SH NOTES
80The
81.BR strcasecmp ()
82and
83.BR strncasecmp ()
84functions first appeared in 4.4BSD, where they were declared in
85.IR <string.h> .
86Thus, for reasons of historical compatibility, the glibc
87.I <string.h>
88header file also declares these functions, if the
89.B _DEFAULT_SOURCE
90(or, in glibc 2.19 and earlier,
91.BR _BSD_SOURCE )
92feature test macro is defined.
847e0d88 93.PP
e20476d3 94The POSIX.1-2008 standard says of these functions:
847e0d88 95.PP
e20476d3
MK
96.RS
97When the
98.B LC_CTYPE
99category of the locale being used is from the POSIX locale,
100these functions shall behave as if the strings had been converted
101to lowercase and then a byte comparison performed.
102Otherwise, the results are unspecified.
103.RE
47297adb 104.SH SEE ALSO
fea681da
MK
105.BR bcmp (3),
106.BR memcmp (3),
107.BR strcmp (3),
108.BR strcoll (3),
d095200e 109.BR string (3),
fea681da
MK
110.BR strncmp (3),
111.BR wcscasecmp (3),
112.BR wcsncasecmp (3)