date and time created 82/10/07 16:40:03 by sam
[unix-history] / usr / src / lib / libc / net / inet_netof.c
/* inet_netof.c 4.1 82/10/07 */
#include <sys/types.h>
#include <net/in.h>
/*
* Return the network number from an internet
* address; handles class a/b/c network #'s.
*/
in_netof(in)
struct in_addr in;
{
#if vax || pdp11
register u_long net;
if ((in.s_addr&IN_CLASSA) == 0)
return (in.s_addr & IN_CLASSA_NET);
if ((in.s_addr&IN_CLASSB) == 0)
return ((int)htons((u_short)(in.s_addr & IN_CLASSB_NET)));
net = htonl((u_long)(in.s_addr & IN_CLASSC_NET));
net >>= 8;
return ((int)net);
#else
return (IN_NETOF(in));
#endif
}