]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/strcmp.3
fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
[thirdparty/man-pages.git] / man3 / strcmp.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:08:52 1993 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 2001-08-31, aeb
31 .\"
32 .TH STRCMP 3 2015-08-08 "" "Linux Programmer's Manual"
33 .SH NAME
34 strcmp, strncmp \- compare two strings
35 .SH SYNOPSIS
36 .nf
37 .B #include <string.h>
38 .PP
39 .BI "int strcmp(const char *" s1 ", const char *" s2 );
40 .PP
41 .BI "int strncmp(const char *" s1 ", const char *" s2 ", size_t " n );
42 .fi
43 .SH DESCRIPTION
44 The
45 .BR strcmp ()
46 function compares the two strings
47 .I s1
48 and
49 .IR s2 .
50 The locale is not taken into account (for a locale-aware comparison, see
51 .BR strcoll (3)).
52 It returns an integer less than, equal to, or greater
53 than zero if
54 .I s1
55 is found, respectively, to be less than,
56 to match, or be greater than
57 .IR s2 .
58 .PP
59 The
60 .BR strncmp ()
61 function is similar, except it compares
62 only the first (at most)
63 .IR n
64 bytes of
65 .I s1
66 and
67 .IR s2 .
68 .SH RETURN VALUE
69 The
70 .BR strcmp ()
71 and
72 .BR strncmp ()
73 functions return an integer
74 less than, equal to, or greater than zero if
75 .I s1
76 (or the first
77 .I n
78 bytes thereof) is found, respectively, to be less than, to
79 match, or be greater than
80 .IR s2 .
81 .SH ATTRIBUTES
82 For an explanation of the terms used in this section, see
83 .BR attributes (7).
84 .TS
85 allbox;
86 lbw19 lb lb
87 l l l.
88 Interface Attribute Value
89 T{
90 .BR strcmp (),
91 .BR strncmp ()
92 T} Thread safety MT-Safe
93 .TE
94 .SH CONFORMING TO
95 POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD.
96 .SH SEE ALSO
97 .BR bcmp (3),
98 .BR memcmp (3),
99 .BR strcasecmp (3),
100 .BR strcoll (3),
101 .BR string (3),
102 .BR strncasecmp (3),
103 .BR strverscmp (3),
104 .BR wcscmp (3),
105 .BR wcsncmp (3)