NetBSD/external/bsd/libbind/dist/isc/bitncmp.mdoc

83 lines
2.0 KiB
Plaintext

.\" Id: bitncmp.mdoc,v 1.3 2004/03/09 06:30:07 marka Exp
.\"
.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (c) 1996,1999 by Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd June 1, 1996
.Dt BITNCMP 3
.Os BSD 4
.Sh NAME
.Nm bitncmp
.Nd compare bit masks
.Sh SYNOPSIS
.Ft int
.Fn bitncmp "const void *l" "const void *r" "int n"
.Sh DESCRIPTION
The function
.Fn bitncmp
compares the
.Dq Fa n
most-significant bits of the two masks pointed to by
.Dq Fa l
and
.Dq Fa r ,
and returns an integer less than, equal to, or greater than 0, according to
whether or not
.Dq Fa l
is lexicographically less than, equal to, or greater than
.Dq Fa r
when taken to be unsigned characters (this behaviour is just like that of
.Xr memcmp 3 ) .
.Pp
.Sy NOTE :
.Fn Bitncmp
assumes
.Sy network byte order ;
this means that the fourth octet of
.Li 192.5.5.240/28
.Li 0x11110000 .
.Sh RETURN VALUES
.Fn Bitncmp
returns values in the manner of
.Xr memcmp 3 :
.Bd -ragged -offset indent
+1 if
.Dq Fa 1
is greater than
.Dq Fa r ;
.Pp
-1 if
.Dq Fa l
is less than
.Dq Fa r ;
and
.Pp
0 if
.Dq Fa l
is equal to
.Dq Fa r ,
.Ed
.Pp
where
.Dq Fa l
and
.Dq Fa r
are both interpreted as strings of unsigned characters (through bit
.Dq Fa n . )
.Sh SEE ALSO
.Xr memcmp 3 .
.Sh AUTHOR
Paul Vixie (ISC).