diff options
author | Mystery Man <unknown@mandriva.org> | 2002-09-20 13:59:57 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2002-09-20 13:59:57 +0000 |
commit | 4394adc363246f041a3eb2a75bfbe451c36bb922 (patch) | |
tree | 23c54c7c0c3deb3dfc6d4ebf9cbf6f3dddf83470 /mdk-stage1/dietlibc/libcruft/inet_aton.c | |
parent | 657b3d01707e205499e3c867cb174c7e0fa1a83e (diff) | |
download | drakx-4394adc363246f041a3eb2a75bfbe451c36bb922.tar drakx-4394adc363246f041a3eb2a75bfbe451c36bb922.tar.gz drakx-4394adc363246f041a3eb2a75bfbe451c36bb922.tar.bz2 drakx-4394adc363246f041a3eb2a75bfbe451c36bb922.tar.xz drakx-4394adc363246f041a3eb2a75bfbe451c36bb922.zip |
This commit was manufactured by cvs2svn to create tag 'V1_1_9_53mdk'.V1_1_9_53mdk
Diffstat (limited to 'mdk-stage1/dietlibc/libcruft/inet_aton.c')
-rw-r--r-- | mdk-stage1/dietlibc/libcruft/inet_aton.c | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/mdk-stage1/dietlibc/libcruft/inet_aton.c b/mdk-stage1/dietlibc/libcruft/inet_aton.c deleted file mode 100644 index ac7d9d007..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_aton.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <stdlib.h> - -/* inet_aton() converts the Internet host address cp from the standard - * numbers-and-dots notation into binary data and stores it in the - * structure that inp points to. inet_aton returns nonzero if the - * address is valid, zero if not. */ - -/* problem is, inet_aton is historically quite, uh, lenient. - * the following are all acceptable: - * 0x7f000001 == 127.1 == 127.0.0.1.0 == 127.0.0.1 - * btw: 127.0.0.x.y == 127.0.0.(x|y) - * and: 10.1.1 == 10.1.0.1 (huh?!) - * and: 10 == 0.0.0.10 (?!?!?) - * The Berkeley people must have been so stoned that they are still high. - */ - -/* I hereby disclaim that I wrote this code. */ -int inet_aton(const char *cp, struct in_addr *inp) { - int i; - unsigned int ip=0; - char *tmp=(char*)cp; - for (i=24; ;) { - long j; - j=strtol(tmp,&tmp,0); - if (*tmp==0) { - ip|=j; - break; - } - if (*tmp=='.') { - if (j>255) return 0; - ip|=(j<<i); - if (i>0) i-=8; - ++tmp; - continue; - } - return 0; - } - inp->s_addr=htonl(ip); - return 1; -} |