add cleandir
[unix-history] / usr / src / lib / libc / net / inet_network.c
index 6969922..d3dafb5 100644 (file)
@@ -1,6 +1,26 @@
-/*     @(#)inet_network.c      4.1     %G%     */
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)inet_network.c     5.5 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 
 #include <sys/types.h>
+#include <netinet/in.h>
 #include <ctype.h>
 
 /*
 #include <ctype.h>
 
 /*
@@ -15,6 +35,7 @@ inet_network(cp)
        register u_long val, base, n;
        register char c;
        u_long parts[4], *pp = parts;
        register u_long val, base, n;
        register char c;
        u_long parts[4], *pp = parts;
+       register int i;
 
 again:
        val = 0; base = 10;
 
 again:
        val = 0; base = 10;
@@ -37,16 +58,16 @@ again:
        }
        if (*cp == '.') {
                if (pp >= parts + 4)
        }
        if (*cp == '.') {
                if (pp >= parts + 4)
-                       return (-1);
+                       return (INADDR_NONE);
                *pp++ = val, cp++;
                goto again;
        }
        if (*cp && !isspace(*cp))
                *pp++ = val, cp++;
                goto again;
        }
        if (*cp && !isspace(*cp))
-               return (-1);
+               return (INADDR_NONE);
        *pp++ = val;
        n = pp - parts;
        if (n > 4)
        *pp++ = val;
        n = pp - parts;
        if (n > 4)
-               return (-1);
+               return (INADDR_NONE);
        for (val = 0, i = 0; i < n; i++) {
                val <<= 8;
                val |= parts[i] & 0xff;
        for (val = 0, i = 0; i < n; i++) {
                val <<= 8;
                val |= parts[i] & 0xff;