xref: /csrg-svn/lib/libc/string/memcmp.3 (revision 61193)
1*61193Sbostic.\" Copyright (c) 1990, 1991, 1993
2*61193Sbostic.\"	The Regents of the University of California.  All rights reserved.
341951Sbostic.\"
441951Sbostic.\" This code is derived from software contributed to Berkeley by
550310Sbostic.\" Chris Torek and the American National Standards Committee X3,
650310Sbostic.\" on Information Processing Systems.
750310Sbostic.\"
841951Sbostic.\" %sccs.include.redist.man%
941951Sbostic.\"
10*61193Sbostic.\"     @(#)memcmp.3	8.1 (Berkeley) 06/04/93
1141951Sbostic.\"
1248351Scael.Dd
1348351Scael.Dt MEMCMP 3
1448351Scael.Os
1548351Scael.Sh NAME
1648351Scael.Nm memcmp
1748351Scael.Nd compare byte string
1848351Scael.Sh SYNOPSIS
1948351Scael.Fd #include <string.h>
2048351Scael.Ft int
2148351Scael.Fn memcmp "const void *b1" "const void *b2" "size_t len"
2248351Scael.Sh DESCRIPTION
2348351ScaelThe
2448351Scael.Fn memcmp
2548351Scaelfunction
2641951Sbosticcompares byte string
2748351Scael.Fa b1
2841951Sbosticagainst byte string
2948351Scael.Fa b2 .
3041951SbosticBoth strings are assumed to be
3148351Scael.Fa len
3241951Sbosticbytes long.
3348351Scael.Sh RETURN VALUES
3448351ScaelThe
3548351Scael.Fn memcmp
3648351Scaelfunction
3748351Scaelreturns zero if the the two strings are identical,
3848351Scaelotherwise returns the difference between the first two differing bytes
3948351Scael(treated as unsigned char values, so that
4048351Scael.Sq Li \e200
4148351Scaelis greater than
4248351Scael.Sq Li \&\e0 ,
4348351Scaelfor example).
4441951SbosticZero-length strings are always identical.
4548351Scael.Sh SEE ALSO
4648351Scael.Xr bcmp 3 ,
4748351Scael.Xr strcasecmp 3 ,
4848351Scael.Xr strcmp 3 ,
4948351Scael.Xr strcoll 3 ,
5048351Scael.Xr strxfrm 3
5148351Scael.Sh STANDARDS
5248351ScaelThe
5348351Scael.Fn memcmp
5448351Scaelfunction
5548351Scaelconforms to
5648351Scael.St -ansiC .
57