bring up to rev 6
[unix-history] / usr / src / lib / libc / net / inet_lnaof.c
CommitLineData
bb0cfa24
DF
1/*
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
2ce81398 7#if defined(LIBC_SCCS) && !defined(lint)
ed2be010 8static char sccsid[] = "@(#)inet_lnaof.c 5.3 (Berkeley) %G%";
2ce81398 9#endif LIBC_SCCS and not lint
a6792f09
SL
10
11#include <sys/types.h>
056d5bbd 12#include <netinet/in.h>
a6792f09
SL
13
14/*
15 * Return the local network address portion of an
16 * internet address; handles class a/b/c network
17 * number formats.
18 */
ed2be010 19u_long
3a3b7ace 20inet_lnaof(in)
a6792f09
SL
21 struct in_addr in;
22{
056d5bbd
SL
23 register u_long i = ntohl(in.s_addr);
24
25 if (IN_CLASSA(i))
26 return ((i)&IN_CLASSA_HOST);
27 else if (IN_CLASSB(i))
28 return ((i)&IN_CLASSB_HOST);
29 else
30 return ((i)&IN_CLASSC_HOST);
a6792f09 31}