From: Keith Bostic Date: Fri, 2 Oct 1987 06:35:23 +0000 (-0800) Subject: INADDR_NONE, not -1; bug report 4.3BSD/lib/22 X-Git-Tag: BSD-4_3_Net_1-Snapshot-Development~3572 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/a02e9915221d0204454b16abb12a04c9636e599e INADDR_NONE, not -1; bug report 4.3BSD/lib/22 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 --- diff --git a/usr/src/lib/libc/net/inet.3 b/usr/src/lib/libc/net/inet.3 index d2eb32c7af..1500d5078d 100644 --- a/usr/src/lib/libc/net/inet.3 +++ b/usr/src/lib/libc/net/inet.3 @@ -2,7 +2,7 @@ .\" 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 @@ -106,7 +106,7 @@ otherwise, the number is interpreted as decimal). .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 diff --git a/usr/src/lib/libc/net/inet_addr.c b/usr/src/lib/libc/net/inet_addr.c index b7936bce7d..de43c19c32 100644 --- a/usr/src/lib/libc/net/inet_addr.c +++ b/usr/src/lib/libc/net/inet_addr.c @@ -5,7 +5,7 @@ */ #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 @@ -61,7 +61,7 @@ again: * a.b (with b treated as 24 bits) */ if (pp >= parts + 4) - return (-1); + return (INADDR_NONE); *pp++ = val, cp++; goto again; } @@ -69,7 +69,7 @@ again: * Check for trailing characters. */ if (*cp && !isspace(*cp)) - return (-1); + return (INADDR_NONE); *pp++ = val; /* * Concoct the address according to @@ -97,7 +97,7 @@ again: break; default: - return (-1); + return (INADDR_NONE); } val = htonl(val); return (val); diff --git a/usr/src/lib/libc/net/inet_network.c b/usr/src/lib/libc/net/inet_network.c index f4d9712c9d..12c7726f50 100644 --- a/usr/src/lib/libc/net/inet_network.c +++ b/usr/src/lib/libc/net/inet_network.c @@ -5,10 +5,11 @@ */ #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 +#include #include /* @@ -46,16 +47,16 @@ again: } if (*cp == '.') { if (pp >= parts + 4) - return (-1); + return (INADDR_NONE); *pp++ = val, cp++; goto again; } if (*cp && !isspace(*cp)) - return (-1); + return (INADDR_NONE); *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;