summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/strcmp.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/string/strcmp.3')
-rw-r--r--src/lib/libc/string/strcmp.347
1 files changed, 24 insertions, 23 deletions
diff --git a/src/lib/libc/string/strcmp.3 b/src/lib/libc/string/strcmp.3
index fecaa85410..5b0794208a 100644
--- a/src/lib/libc/string/strcmp.3
+++ b/src/lib/libc/string/strcmp.3
@@ -1,3 +1,5 @@
1.\" $OpenBSD: strcmp.3,v 1.12 2011/07/25 07:51:30 jmc Exp $
2.\"
1.\" Copyright (c) 1990, 1991 The Regents of the University of California. 3.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" All rights reserved. 4.\" All rights reserved.
3.\" 5.\"
@@ -13,11 +15,7 @@
13.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in the 16.\" notice, this list of conditions and the following disclaimer in the
15.\" documentation and/or other materials provided with the distribution. 17.\" documentation and/or other materials provided with the distribution.
16.\" 3. All advertising materials mentioning features or use of this software 18.\" 3. Neither the name of the University nor the names of its contributors
17.\" must display the following acknowledgement:
18.\" This product includes software developed by the University of
19.\" California, Berkeley and its contributors.
20.\" 4. Neither the name of the University nor the names of its contributors
21.\" may be used to endorse or promote products derived from this software 19.\" may be used to endorse or promote products derived from this software
22.\" without specific prior written permission. 20.\" without specific prior written permission.
23.\" 21.\"
@@ -33,14 +31,12 @@
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE. 32.\" SUCH DAMAGE.
35.\" 33.\"
36.\" from: @(#)strcmp.3 5.6 (Berkeley) 6/29/91 34.Dd $Mdocdate: July 25 2011 $
37.\" $Id: strcmp.3,v 1.1.1.1 1995/10/18 08:42:22 deraadt Exp $
38.\"
39.Dd June 29, 1991
40.Dt STRCMP 3 35.Dt STRCMP 3
41.Os 36.Os
42.Sh NAME 37.Sh NAME
43.Nm strcmp 38.Nm strcmp ,
39.Nm strncmp
44.Nd compare strings 40.Nd compare strings
45.Sh SYNOPSIS 41.Sh SYNOPSIS
46.Fd #include <string.h> 42.Fd #include <string.h>
@@ -53,18 +49,22 @@ The
53.Fn strcmp 49.Fn strcmp
54and 50and
55.Fn strncmp 51.Fn strncmp
56functions 52functions lexicographically compare the NUL-terminated strings
57lexicographically compare the null-terminated strings
58.Fa s1 53.Fa s1
59and 54and
60.Fa s2 . 55.Fa s2 .
56The
57.Fn strncmp
58function compares at most
59.Fa len
60characters.
61.Sh RETURN VALUES 61.Sh RETURN VALUES
62The 62The
63.Fn strcmp 63.Fn strcmp
64and 64and
65.Fn strncmp 65.Fn strncmp
66return an integer greater than, equal to, or less than 0, according 66functions return an integer greater than, equal to, or less than 0, according
67as the string 67to whether the string
68.Fa s1 68.Fa s1
69is greater than, equal to, or less than the string 69is greater than, equal to, or less than the string
70.Fa s2 . 70.Fa s2 .
@@ -72,23 +72,24 @@ The comparison is done using unsigned characters, so that
72.Ql \e200 72.Ql \e200
73is greater than 73is greater than
74.Ql \e0 . 74.Ql \e0 .
75.Pp
76The
77.Fn strncmp
78compares not more than
79.Fa len
80characters.
81.Sh SEE ALSO 75.Sh SEE ALSO
82.Xr bcmp 3 , 76.Xr bcmp 3 ,
83.Xr memcmp 3 , 77.Xr memcmp 3 ,
84.Xr strcasecmp 3 , 78.Xr strcasecmp 3 ,
85.Xr strcoll 3 , 79.Xr strcoll 3 ,
86.Xr strxfrm 3 80.Xr strxfrm 3 ,
81.Xr wcscmp 3
87.Sh STANDARDS 82.Sh STANDARDS
88The 83The
89.Fn strcmp 84.Fn strcmp
90and 85and
91.Fn strncmp 86.Fn strncmp
92functions 87functions conform to
93conform to
94.St -ansiC . 88.St -ansiC .
89.Sh HISTORY
90The
91.Fn strcmp
92and
93.Fn strncmp
94functions first appeared in
95.At v7 .