freebsd-dev/usr.sbin/xntpd/lib/netof.c

25 lines
428 B
C
Raw Normal View History

1995-05-30 03:57:47 +00:00
/*
1994-04-03 19:50:51 +00:00
* netof - return the net address part of an ip address
* (zero out host part)
*/
#include <stdio.h>
#include "ntp_fp.h"
#include "ntp_stdlib.h"
1994-09-29 23:04:24 +00:00
u_long
1994-04-03 19:50:51 +00:00
netof(num)
1994-09-29 23:04:24 +00:00
u_long num;
1994-04-03 19:50:51 +00:00
{
1994-09-29 23:04:24 +00:00
register u_long netnum;
1994-04-03 19:50:51 +00:00
netnum = num;
if(IN_CLASSC(netnum))
netnum &= IN_CLASSC_NET;
else if (IN_CLASSB(netnum))
netnum &= IN_CLASSB_NET;
1994-09-29 23:04:24 +00:00
else /* treat all other like class A */
1994-04-03 19:50:51 +00:00
netnum &= IN_CLASSA_NET;
return netnum;
}