INADDR_NONE, not -1; bug report 4.3BSD/lib/22
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 2 Oct 1987 06:35:23 +0000 (22:35 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 2 Oct 1987 06:35:23 +0000 (22:35 -0800)
SCCS-vsn: lib/libc/net/inet_addr.c 5.4
SCCS-vsn: lib/libc/net/inet_network.c 5.3
SCCS-vsn: lib/libc/net/inet.3 6.5

usr/src/lib/libc/net/inet.3
usr/src/lib/libc/net/inet_addr.c
usr/src/lib/libc/net/inet_network.c

index d2eb32c..1500d50 100644 (file)
@@ -2,7 +2,7 @@
 .\" All rights reserved.  The Berkeley software License Agreement
 .\" specifies the terms and conditions for redistribution.
 .\"
 .\" All rights reserved.  The Berkeley software License Agreement
 .\" specifies the terms and conditions for redistribution.
 .\"
-.\"    @(#)inet.3      6.4 (Berkeley) %G%
+.\"    @(#)inet.3      6.5 (Berkeley) %G%
 .\"
 .TH INET 3N ""
 .UC 5
 .\"
 .TH INET 3N ""
 .UC 5
@@ -106,7 +106,7 @@ otherwise, the number is interpreted as decimal).
 .SH "SEE ALSO"
 gethostbyname(3N), getnetent(3N), hosts(5), networks(5),
 .SH DIAGNOSTICS
 .SH "SEE ALSO"
 gethostbyname(3N), getnetent(3N), hosts(5), networks(5),
 .SH DIAGNOSTICS
-The value \-1 is returned by
+The constant \fBINADDR_NONE\fP is returned by
 .I inet_addr
 and
 .I inet_network
 .I inet_addr
 and
 .I inet_network
index b7936bc..de43c19 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_addr.c        5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)inet_addr.c        5.4 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 #include <sys/types.h>
 #endif LIBC_SCCS and not lint
 
 #include <sys/types.h>
@@ -61,7 +61,7 @@ again:
                 *      a.b     (with b treated as 24 bits)
                 */
                if (pp >= parts + 4)
                 *      a.b     (with b treated as 24 bits)
                 */
                if (pp >= parts + 4)
-                       return (-1);
+                       return (INADDR_NONE);
                *pp++ = val, cp++;
                goto again;
        }
                *pp++ = val, cp++;
                goto again;
        }
@@ -69,7 +69,7 @@ again:
         * Check for trailing characters.
         */
        if (*cp && !isspace(*cp))
         * Check for trailing characters.
         */
        if (*cp && !isspace(*cp))
-               return (-1);
+               return (INADDR_NONE);
        *pp++ = val;
        /*
         * Concoct the address according to
        *pp++ = val;
        /*
         * Concoct the address according to
@@ -97,7 +97,7 @@ again:
                break;
 
        default:
                break;
 
        default:
-               return (-1);
+               return (INADDR_NONE);
        }
        val = htonl(val);
        return (val);
        }
        val = htonl(val);
        return (val);
index f4d9712..12c7726 100644 (file)
@@ -5,10 +5,11 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_network.c     5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)inet_network.c     5.3 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 #include <sys/types.h>
 #endif LIBC_SCCS and not lint
 
 #include <sys/types.h>
+#include <netinet/in.h>
 #include <ctype.h>
 
 /*
 #include <ctype.h>
 
 /*
@@ -46,16 +47,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;