purge socketaddr call in favor of getsockname
[unix-history] / usr / src / lib / libc / net / inet_lnaof.c
CommitLineData
056d5bbd 1/* inet_lnaof.c 4.3 82/11/14 */
a6792f09
SL
2
3#include <sys/types.h>
056d5bbd 4#include <netinet/in.h>
a6792f09
SL
5
6/*
7 * Return the local network address portion of an
8 * internet address; handles class a/b/c network
9 * number formats.
10 */
3a3b7ace 11inet_lnaof(in)
a6792f09
SL
12 struct in_addr in;
13{
056d5bbd
SL
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);
a6792f09 22}