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