OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / 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  2014-01-20 "" "Linux Programmer's Manual"
33 .SH NAME
34 strcmp, 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
44 The
45 .BR strcmp ()
46 function compares the two strings
47 .I s1
48 and
49 .IR s2 .
50 It returns an integer less than, equal to, or greater
51 than zero if
52 .I s1
53 is found, respectively, to be less than,
54 to match, or be greater than
55 .IR s2 .
56 .PP
57 The
58 .BR strncmp ()
59 function is similar, except it compares
60 only the first (at most)
61 .IR n
62 bytes of
63 .I s1
64 and
65 .IR s2 .
66 .SH RETURN VALUE
67 The
68 .BR strcmp ()
69 and
70 .BR strncmp ()
71 functions return an integer
72 less than, equal to, or greater than zero if
73 .I s1
74 (or the first
75 .I n
76 bytes thereof) is found, respectively, to be less than, to
77 match, or be greater than
78 .IR s2 .
79 .SH ATTRIBUTES
80 .SS Multithreading (see pthreads(7))
81 The
82 .BR strcmp ()
83 and
84 .BR strncmp ()
85 functions are thread-safe.
86 .SH CONFORMING TO
87 SVr4, 4.3BSD, C89, C99.
88 .SH SEE ALSO
89 .BR bcmp (3),
90 .BR memcmp (3),
91 .BR strcasecmp (3),
92 .BR strcoll (3),
93 .BR string (3),
94 .BR strncasecmp (3),
95 .BR strverscmp (3),
96 .BR wcscmp (3),
97 .BR wcsncmp (3)
98 .SH COLOPHON
99 This page is part of release 3.79 of the Linux
100 .I man-pages
101 project.
102 A description of the project,
103 information about reporting bugs,
104 and the latest version of this page,
105 can be found at
106 \%http://www.kernel.org/doc/man\-pages/.