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