aboutsummaryrefslogtreecommitdiff
path: root/resolv/inet_addr.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-08-22 22:47:57 +0000
committerRoland McGrath <roland@gnu.org>1995-08-22 22:47:57 +0000
commit3cf595e562f955e399d80ea9d053e41d50469e6b (patch)
tree77ed930262ae9606543c580c4a3d69141c1bd561 /resolv/inet_addr.c
parent207eb76afba6503af9c4ab5711bfd76f9697c1ad (diff)
downloadglibc-3cf595e562f955e399d80ea9d053e41d50469e6b.zip
glibc-3cf595e562f955e399d80ea9d053e41d50469e6b.tar.gz
glibc-3cf595e562f955e399d80ea9d053e41d50469e6b.tar.bz2
Tue Aug 22 16:49:12 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* inet/netdb.h: Moved to resolv. * inet/Makefile (headers): Remove netdb.h. * resolv/Makefile (headers): Add netdb.h. * resolv/gethnamaddr.c, resolv/inet_addr.c, resolv/netdb.h, resolv/res_send.c: Updated from BIND-4.9.3-BETA26. * hurd/thread-cancel.c: If SS->cancel_hook is not null, call it before resuming the thread. * hurd/hurd/signal.h (struct hurd_sigstate): New member `cancel_hook'. * hurd/Makefile: Removed dep on hurd/signal.h for RPC stub objects. Mon Aug 21 16:37:09 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> * sysdeps/i386/dl-machine.h (elf_machine_rel): Grok R_386_NONE relocs, and do nothing. Why the linker generates them we may never know. * sysdeps/mach/hurd/i386/intr-msg.h: New file.
Diffstat (limited to 'resolv/inet_addr.c')
-rw-r--r--resolv/inet_addr.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c
index 2a15067..01a38e6 100644
--- a/resolv/inet_addr.c
+++ b/resolv/inet_addr.c
@@ -66,10 +66,6 @@ static char rcsid[] = "$Id$";
/* these are compatibility routines, not needed on recent BSD releases */
-#ifndef NEED_INETADDR
-int __inet_addr_unneeded__;
-#else
-
/*
* Ascii internet address interpretation routine.
* The value returned is in network order.
@@ -84,11 +80,6 @@ inet_addr(cp)
return (val.s_addr);
return (INADDR_NONE);
}
-#endif /*NEED_INETADDR*/
-
-#ifndef NEED_INETATON
-int __inet_aton_unneeded__;
-#else
/*
* Check whether "cp" is a valid ascii representation
@@ -113,8 +104,10 @@ inet_aton(cp, addr)
/*
* Collect number up to ``.''.
* Values are specified as for C:
- * 0x=hex, 0=octal, other=decimal.
+ * 0x=hex, 0=octal, isdigit=decimal.
*/
+ if (!isdigit(c))
+ return (0);
val = 0; base = 10;
if (c == '0') {
c = *++cp;
@@ -123,7 +116,7 @@ inet_aton(cp, addr)
else
base = 8;
}
- while (c != '\0') {
+ for (;;) {
if (isascii(c) && isdigit(c)) {
val = (val * base) + (c - '0');
c = *++cp;
@@ -141,7 +134,7 @@ inet_aton(cp, addr)
* a.b.c (with c treated as 16 bits)
* a.b (with b treated as 24 bits)
*/
- if (pp >= parts + 3 || val > 0xff)
+ if (pp >= parts + 3)
return (0);
*pp++ = val;
c = *++cp;
@@ -151,7 +144,7 @@ inet_aton(cp, addr)
/*
* Check for trailing characters.
*/
- if (c && (!isascii(c) || (!isspace(c) && !ispunct(c))))
+ if (c != '\0' && (!isascii(c) || !isspace(c)))
return (0);
/*
* Concoct the address according to
@@ -188,4 +181,3 @@ inet_aton(cp, addr)
addr->s_addr = htonl(val);
return (1);
}
-#endif /*NEED_INETATON*/