fix file closes so multiple rcmd's work.
[unix-history] / usr / src / lib / libc / net / inet_lnaof.c
index 911d594..52c56bf 100644 (file)
@@ -1,23 +1,22 @@
-/*     inet_lnaof.c    4.1     82/10/07        */
+/*     inet_lnaof.c    4.3     82/11/14        */
 
 #include <sys/types.h>
 
 #include <sys/types.h>
-#include <net/in.h>
+#include <netinet/in.h>
 
 /*
  * Return the local network address portion of an
  * internet address; handles class a/b/c network
  * number formats.
  */
 
 /*
  * Return the local network address portion of an
  * internet address; handles class a/b/c network
  * number formats.
  */
-in_lnaof(in)
+inet_lnaof(in)
        struct in_addr in;
 {
        struct in_addr in;
 {
-#if vax || pdp11
-#define        IN_LNAOF(in) \
-       (((in).s_addr&IN_CLASSA) == 0 ? (in).s_addr&IN_CLASSA_LNA : \
-               ((in).s_addr&IN_CLASSB) == 0 ? (in).s_addr&IN_CLASSB_LNA : \
-                       (in).s_addr&IN_CLASSC_LNA)
-       return ((int)htonl((u_long)IN_LNAOF(in)));
-#else
-       return (IN_LNAOF(in));
-#endif
+       register u_long i = ntohl(in.s_addr);
+
+       if (IN_CLASSA(i))
+               return ((i)&IN_CLASSA_HOST);
+       else if (IN_CLASSB(i))
+               return ((i)&IN_CLASSB_HOST);
+       else
+               return ((i)&IN_CLASSC_HOST);
 }
 }