xref: /original-bsd/lib/libc/net/inet_lnaof.c (revision 264c46cb)
1 /*	inet_lnaof.c	4.3	82/11/14	*/
2 
3 #include <sys/types.h>
4 #include <netinet/in.h>
5 
6 /*
7  * Return the local network address portion of an
8  * internet address; handles class a/b/c network
9  * number formats.
10  */
11 inet_lnaof(in)
12 	struct in_addr in;
13 {
14 	register u_long i = ntohl(in.s_addr);
15 
16 	if (IN_CLASSA(i))
17 		return ((i)&IN_CLASSA_HOST);
18 	else if (IN_CLASSB(i))
19 		return ((i)&IN_CLASSB_HOST);
20 	else
21 		return ((i)&IN_CLASSC_HOST);
22 }
23