add new opcodes
[unix-history] / usr / src / lib / libc / net / inet_lnaof.c
... / ...
CommitLineData
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
7#if defined(LIBC_SCCS) && !defined(lint)
8static char sccsid[] = "@(#)inet_lnaof.c 5.2 (Berkeley) %G%";
9#endif LIBC_SCCS and not lint
10
11#include <sys/types.h>
12#include <netinet/in.h>
13
14/*
15 * Return the local network address portion of an
16 * internet address; handles class a/b/c network
17 * number formats.
18 */
19inet_lnaof(in)
20 struct in_addr in;
21{
22 register u_long i = ntohl(in.s_addr);
23
24 if (IN_CLASSA(i))
25 return ((i)&IN_CLASSA_HOST);
26 else if (IN_CLASSB(i))
27 return ((i)&IN_CLASSB_HOST);
28 else
29 return ((i)&IN_CLASSC_HOST);
30}