date and time created 82/10/07 16:40:02 by sam
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Fri, 8 Oct 1982 08:40:02 +0000 (00:40 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Fri, 8 Oct 1982 08:40:02 +0000 (00:40 -0800)
SCCS-vsn: lib/libc/net/inet_makeaddr.c 4.1

usr/src/lib/libc/net/inet_makeaddr.c [new file with mode: 0644]

diff --git a/usr/src/lib/libc/net/inet_makeaddr.c b/usr/src/lib/libc/net/inet_makeaddr.c
new file mode 100644 (file)
index 0000000..b77fc81
--- /dev/null
@@ -0,0 +1,24 @@
+/*     inet_makeaddr.c 4.1     82/10/07        */
+
+#include <sys/types.h>
+#include <net/in.h>
+
+/*
+ * 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);
+}