]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/strcasecmp.3
fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
[thirdparty/man-pages.git] / man3 / strcasecmp.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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.
12 .\"
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.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
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)
30 .TH STRCASECMP 3 2017-09-15 "" "Linux Programmer's Manual"
31 .SH NAME
32 strcasecmp, strncasecmp \- compare two strings ignoring case
33 .SH SYNOPSIS
34 .nf
35 .B #include <strings.h>
36 .PP
37 .BI "int strcasecmp(const char *" s1 ", const char *" s2 );
38 .PP
39 .BI "int strncasecmp(const char *" s1 ", const char *" s2 ", size_t " n );
40 .fi
41 .SH DESCRIPTION
42 The
43 .BR strcasecmp ()
44 function performs a byte-by-byte comparison of the strings
45 .I s1
46 and
47 .IR s2 ,
48 ignoring the case of the characters.
49 It returns an integer
50 less than, equal to, or greater than zero if
51 .I s1
52 is found,
53 respectively, to be less than, to match, or be greater than
54 .IR s2 .
55 .PP
56 The
57 .BR strncasecmp ()
58 function is similar, except that it compares
59 no more than
60 .I n
61 bytes of
62 .IR s1
63 and
64 .IR s2 .
65 .SH RETURN VALUE
66 The
67 .BR strcasecmp ()
68 and
69 .BR strncasecmp ()
70 functions return
71 an integer less than, equal to, or greater than zero if
72 .I s1
73 is, after ignoring case, found to be
74 less than, to match, or be greater than
75 .IR s2 ,
76 respectively.
77 .SH ATTRIBUTES
78 For an explanation of the terms used in this section, see
79 .BR attributes (7).
80 .TS
81 allbox;
82 lbw27 lb lb
83 l l l.
84 Interface Attribute Value
85 T{
86 .BR strcasecmp (),
87 .BR strncasecmp ()
88 T} Thread safety MT-Safe locale
89 .TE
90 .SH CONFORMING TO
91 4.4BSD, POSIX.1-2001, POSIX.1-2008.
92 .SH NOTES
93 The
94 .BR strcasecmp ()
95 and
96 .BR strncasecmp ()
97 functions first appeared in 4.4BSD, where they were declared in
98 .IR <string.h> .
99 Thus, for reasons of historical compatibility, the glibc
100 .I <string.h>
101 header file also declares these functions, if the
102 .B _DEFAULT_SOURCE
103 (or, in glibc 2.19 and earlier,
104 .BR _BSD_SOURCE )
105 feature test macro is defined.
106 .PP
107 The POSIX.1-2008 standard says of these functions:
108 .PP
109 .RS
110 When the
111 .B LC_CTYPE
112 category of the locale being used is from the POSIX locale,
113 these functions shall behave as if the strings had been converted
114 to lowercase and then a byte comparison performed.
115 Otherwise, the results are unspecified.
116 .RE
117 .SH SEE ALSO
118 .BR bcmp (3),
119 .BR memcmp (3),
120 .BR strcmp (3),
121 .BR strcoll (3),
122 .BR string (3),
123 .BR strncmp (3),
124 .BR wcscasecmp (3),
125 .BR wcsncasecmp (3)