]>
Commit | Line | Data |
---|---|---|
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 |
12 | strcasecmp, strncasecmp \- compare two strings ignoring case | |
0781f22b AC |
13 | .SH LIBRARY |
14 | Standard 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 |
24 | The |
25 | .BR strcasecmp () | |
e20476d3 | 26 | function performs a byte-by-byte comparison of the strings |
46d8df8e MK |
27 | .I s1 |
28 | and | |
29 | .IR s2 , | |
30 | ignoring the case of the characters. | |
c13182ef | 31 | It returns an integer |
46d8df8e MK |
32 | less than, equal to, or greater than zero if |
33 | .I s1 | |
34 | is found, | |
35 | respectively, to be less than, to match, or be greater than | |
36 | .IR s2 . | |
fea681da | 37 | .PP |
60a90ecd MK |
38 | The |
39 | .BR strncasecmp () | |
2392242b MK |
40 | function is similar, except that it compares |
41 | no more than | |
46d8df8e MK |
42 | .I n |
43 | bytes of | |
1ae6b2c7 | 44 | .I s1 |
0ee67404 MK |
45 | and |
46 | .IR s2 . | |
47297adb | 47 | .SH RETURN VALUE |
60a90ecd MK |
48 | The |
49 | .BR strcasecmp () | |
50 | and | |
51 | .BR strncasecmp () | |
52 | functions return | |
46d8df8e MK |
53 | an integer less than, equal to, or greater than zero if |
54 | .I s1 | |
2392242b | 55 | is, after ignoring case, found to be |
46d8df8e | 56 | less than, to match, or be greater than |
2392242b MK |
57 | .IR s2 , |
58 | respectively. | |
8a4afcf3 PH |
59 | .SH ATTRIBUTES |
60 | For 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 |
65 | allbox; | |
c466875e | 66 | lbx lb lb |
8a4afcf3 PH |
67 | l l l. |
68 | Interface Attribute Value | |
69 | T{ | |
70 | .BR strcasecmp (), | |
71 | .BR strncasecmp () | |
72 | T} Thread safety MT-Safe locale | |
73 | .TE | |
c466875e MK |
74 | .hy |
75 | .ad | |
76 | .sp 1 | |
3113c7f3 | 77 | .SH STANDARDS |
cad62ef6 | 78 | 4.4BSD, POSIX.1-2001, POSIX.1-2008. |
ca24d850 MK |
79 | .SH NOTES |
80 | The | |
81 | .BR strcasecmp () | |
82 | and | |
83 | .BR strncasecmp () | |
84 | functions first appeared in 4.4BSD, where they were declared in | |
85 | .IR <string.h> . | |
86 | Thus, for reasons of historical compatibility, the glibc | |
87 | .I <string.h> | |
88 | header file also declares these functions, if the | |
89 | .B _DEFAULT_SOURCE | |
90 | (or, in glibc 2.19 and earlier, | |
91 | .BR _BSD_SOURCE ) | |
92 | feature test macro is defined. | |
847e0d88 | 93 | .PP |
e20476d3 | 94 | The POSIX.1-2008 standard says of these functions: |
847e0d88 | 95 | .PP |
e20476d3 MK |
96 | .RS |
97 | When the | |
98 | .B LC_CTYPE | |
99 | category of the locale being used is from the POSIX locale, | |
100 | these functions shall behave as if the strings had been converted | |
101 | to lowercase and then a byte comparison performed. | |
102 | Otherwise, 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) |