date and time created 82/10/07 16:40:02 by sam
[unix-history] / usr / src / lib / libc / net / inet_makeaddr.c
CommitLineData
9b8667c0
SL
1/* inet_makeaddr.c 4.1 82/10/07 */
2
3#include <sys/types.h>
4#include <net/in.h>
5
6/*
7 * Formulate an Internet address from network + host. Used in
8 * building addresses stored in the ifnet structure.
9 */
10struct in_addr
11if_makeaddr(net, host)
12 int net, host;
13{
14 u_long addr;
15
16 if (net < 128)
17 addr = (net << 24) | host;
18 else if (net < 65536)
19 addr = (net << 16) | host;
20 else
21 addr = (net << 8) | host;
22 addr = htonl(addr);
23 return (*(struct in_addr *)&addr);
24}