inet_aton returns a boolean success value, whereas __ipparse returns 0 on success and -1 on failure. also change the conditional in inet_addr to be consistent with other uses of __ipparse where only negative values are treated as failure.
12 lines
233 B
C
12 lines
233 B
C
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include "__dns.h"
|
|
|
|
in_addr_t inet_addr(const char *p)
|
|
{
|
|
struct sockaddr_in sin;
|
|
if (__ipparse(&sin, AF_INET, p) < 0) return -1;
|
|
return sin.sin_addr.s_addr;
|
|
}
|