1.\" Id: bitncmp.mdoc,v 1.3 2004/03/09 06:30:07 marka Exp 2.\" 3.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 4.\" Copyright (c) 1996,1999 by Internet Software Consortium. 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 16.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.Dd June 1, 1996 19.Dt BITNCMP 3 20.Os BSD 4 21.Sh NAME 22.Nm bitncmp 23.Nd compare bit masks 24.Sh SYNOPSIS 25.Ft int 26.Fn bitncmp "const void *l" "const void *r" "int n" 27.Sh DESCRIPTION 28The function 29.Fn bitncmp 30compares the 31.Dq Fa n 32most-significant bits of the two masks pointed to by 33.Dq Fa l 34and 35.Dq Fa r , 36and returns an integer less than, equal to, or greater than 0, according to 37whether or not 38.Dq Fa l 39is lexicographically less than, equal to, or greater than 40.Dq Fa r 41when taken to be unsigned characters (this behaviour is just like that of 42.Xr memcmp 3 ) . 43.Pp 44.Sy NOTE : 45.Fn Bitncmp 46assumes 47.Sy network byte order ; 48this means that the fourth octet of 49.Li 192.5.5.240/28 50.Li 0x11110000 . 51.Sh RETURN VALUES 52.Fn Bitncmp 53returns values in the manner of 54.Xr memcmp 3 : 55.Bd -ragged -offset indent 56+1 if 57.Dq Fa 1 58is greater than 59.Dq Fa r ; 60.Pp 61-1 if 62.Dq Fa l 63is less than 64.Dq Fa r ; 65and 66.Pp 670 if 68.Dq Fa l 69is equal to 70.Dq Fa r , 71.Ed 72.Pp 73where 74.Dq Fa l 75and 76.Dq Fa r 77are both interpreted as strings of unsigned characters (through bit 78.Dq Fa n . ) 79.Sh SEE ALSO 80.Xr memcmp 3 . 81.Sh AUTHOR 82Paul Vixie (ISC). 83