From: Sam Leffler Date: Fri, 8 Oct 1982 08:40:02 +0000 (-0800) Subject: date and time created 82/10/07 16:40:02 by sam X-Git-Tag: BSD-4_1c_2-Snapshot-Development~2310 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/9b8667c088b6d0a7927d6d5f494d4b0f235eb9e8?hp=a6792f097eaef9c27d632f3d934822ed00ad3a98 date and time created 82/10/07 16:40:02 by sam SCCS-vsn: lib/libc/net/inet_makeaddr.c 4.1 --- diff --git a/usr/src/lib/libc/net/inet_makeaddr.c b/usr/src/lib/libc/net/inet_makeaddr.c new file mode 100644 index 0000000000..b77fc8180b --- /dev/null +++ b/usr/src/lib/libc/net/inet_makeaddr.c @@ -0,0 +1,24 @@ +/* inet_makeaddr.c 4.1 82/10/07 */ + +#include +#include + +/* + * Formulate an Internet address from network + host. Used in + * building addresses stored in the ifnet structure. + */ +struct in_addr +if_makeaddr(net, host) + int net, host; +{ + u_long addr; + + if (net < 128) + addr = (net << 24) | host; + else if (net < 65536) + addr = (net << 16) | host; + else + addr = (net << 8) | host; + addr = htonl(addr); + return (*(struct in_addr *)&addr); +}