]>
Commit | Line | Data |
---|---|---|
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) | |
3df541c0 | 30 | .TH STRCASECMP 3 2016-07-17 "" "Linux Programmer's Manual" |
fea681da MK |
31 | .SH NAME |
32 | strcasecmp, 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 |
42 | The |
43 | .BR strcasecmp () | |
e20476d3 | 44 | function performs a byte-by-byte comparison of the strings |
46d8df8e MK |
45 | .I s1 |
46 | and | |
47 | .IR s2 , | |
48 | ignoring the case of the characters. | |
c13182ef | 49 | It returns an integer |
46d8df8e MK |
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 . | |
fea681da | 55 | .PP |
60a90ecd MK |
56 | The |
57 | .BR strncasecmp () | |
2392242b MK |
58 | function is similar, except that it compares |
59 | no more than | |
46d8df8e MK |
60 | .I n |
61 | bytes of | |
0ee67404 MK |
62 | .IR s1 |
63 | and | |
64 | .IR s2 . | |
47297adb | 65 | .SH RETURN VALUE |
60a90ecd MK |
66 | The |
67 | .BR strcasecmp () | |
68 | and | |
69 | .BR strncasecmp () | |
70 | functions return | |
46d8df8e MK |
71 | an integer less than, equal to, or greater than zero if |
72 | .I s1 | |
2392242b | 73 | is, after ignoring case, found to be |
46d8df8e | 74 | less than, to match, or be greater than |
2392242b MK |
75 | .IR s2 , |
76 | respectively. | |
8a4afcf3 PH |
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 | |
47297adb | 90 | .SH CONFORMING TO |
cad62ef6 | 91 | 4.4BSD, POSIX.1-2001, POSIX.1-2008. |
ca24d850 MK |
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. | |
847e0d88 | 106 | .PP |
e20476d3 | 107 | The POSIX.1-2008 standard says of these functions: |
847e0d88 | 108 | .PP |
e20476d3 MK |
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 | |
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) |