xref: /csrg-svn/lib/libc/string/memcmp.3 (revision 48351)
1*48351Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California.
241951Sbostic.\" All rights reserved.
341951Sbostic.\"
441951Sbostic.\" This code is derived from software contributed to Berkeley by
541951Sbostic.\" Chris Torek.
641951Sbostic.\" %sccs.include.redist.man%
741951Sbostic.\"
8*48351Scael.\"     @(#)memcmp.3	5.4 (Berkeley) 04/19/91
941951Sbostic.\"
10*48351Scael.Dd
11*48351Scael.Dt MEMCMP 3
12*48351Scael.Os
13*48351Scael.Sh NAME
14*48351Scael.Nm memcmp
15*48351Scael.Nd compare byte string
16*48351Scael.Sh SYNOPSIS
17*48351Scael.Fd #include <string.h>
18*48351Scael.Ft int
19*48351Scael.Fn memcmp "const void *b1" "const void *b2" "size_t len"
20*48351Scael.Sh DESCRIPTION
21*48351ScaelThe
22*48351Scael.Fn memcmp
23*48351Scaelfunction
2441951Sbosticcompares byte string
25*48351Scael.Fa b1
2641951Sbosticagainst byte string
27*48351Scael.Fa b2 .
2841951SbosticBoth strings are assumed to be
29*48351Scael.Fa len
3041951Sbosticbytes long.
31*48351Scael.Sh RETURN VALUES
32*48351ScaelThe
33*48351Scael.Fn memcmp
34*48351Scaelfunction
35*48351Scaelreturns zero if the the two strings are identical,
36*48351Scaelotherwise returns the difference between the first two differing bytes
37*48351Scael(treated as unsigned char values, so that
38*48351Scael.Sq Li \e200
39*48351Scaelis greater than
40*48351Scael.Sq Li \&\e0 ,
41*48351Scaelfor example).
4241951SbosticZero-length strings are always identical.
43*48351Scael.Sh SEE ALSO
44*48351Scael.Xr bcmp 3 ,
45*48351Scael.Xr strcasecmp 3 ,
46*48351Scael.Xr strcmp 3 ,
47*48351Scael.Xr strcoll 3 ,
48*48351Scael.Xr strxfrm 3
49*48351Scael.Sh STANDARDS
50*48351ScaelThe
51*48351Scael.Fn memcmp
52*48351Scaelfunction
53*48351Scaelconforms to
54*48351Scael.St -ansiC .
55