xref: /original-bsd/lib/libc/string/memcmp.3 (revision 4092c5cc)
1.\" Copyright (c) 1990, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" %sccs.include.redist.man%
9.\"
10.\"     @(#)memcmp.3	8.1 (Berkeley) 06/04/93
11.\"
12.Dd
13.Dt MEMCMP 3
14.Os
15.Sh NAME
16.Nm memcmp
17.Nd compare byte string
18.Sh SYNOPSIS
19.Fd #include <string.h>
20.Ft int
21.Fn memcmp "const void *b1" "const void *b2" "size_t len"
22.Sh DESCRIPTION
23The
24.Fn memcmp
25function
26compares byte string
27.Fa b1
28against byte string
29.Fa b2 .
30Both strings are assumed to be
31.Fa len
32bytes long.
33.Sh RETURN VALUES
34The
35.Fn memcmp
36function
37returns zero if the the two strings are identical,
38otherwise returns the difference between the first two differing bytes
39(treated as unsigned char values, so that
40.Sq Li \e200
41is greater than
42.Sq Li \&\e0 ,
43for example).
44Zero-length strings are always identical.
45.Sh SEE ALSO
46.Xr bcmp 3 ,
47.Xr strcasecmp 3 ,
48.Xr strcmp 3 ,
49.Xr strcoll 3 ,
50.Xr strxfrm 3
51.Sh STANDARDS
52The
53.Fn memcmp
54function
55conforms to
56.St -ansiC .
57