From 0bec01198bd55dc9b2ef574372852693c2e44da7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 25 Nov 2000 10:23:55 +0000 Subject: [PATCH] * net.cc (cygwin_inet_aton): New function. * cygwin.din: Export cygwin_inet_aton as inet_aton. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/cygwin.din | 1 + winsup/cygwin/net.cc | 18 ++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 492051982..d5a32980c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Sat Nov 25 11:07:00 2000 Corinna Vinschen + + * net.cc (cygwin_inet_aton): New function. + * cygwin.din: Export cygwin_inet_aton as inet_aton. + Sat Nov 25 01:57:42 2000 Kazuhiro Fujieda * path.cc (mount_info::read_cygdrive_info_from_registry): Read system diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index 2399c8bf3..cde180e5c 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -949,6 +949,7 @@ _select = cygwin_select send = cygwin_send socket = cygwin_socket setsockopt = cygwin_setsockopt +inet_aton = cygwin_inet_aton inet_ntoa = cygwin_inet_ntoa recvfrom = cygwin_recvfrom sendto = cygwin_sendto diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 663fd166c..cf5a98dec 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -106,7 +106,7 @@ dump_protoent (struct protoent *p) debug_printf ("protoent %s %x %x", p->p_name, p->p_aliases, p->p_proto); } -/* exported as inet_ntoa: standards? */ +/* exported as inet_ntoa: BSD 4.3 */ extern "C" char * cygwin_inet_ntoa (struct in_addr in) { @@ -114,7 +114,7 @@ cygwin_inet_ntoa (struct in_addr in) return res; } -/* exported as inet_addr: standards? */ +/* exported as inet_addr: BSD 4.3 */ extern "C" unsigned long cygwin_inet_addr (const char *cp) { @@ -122,6 +122,20 @@ cygwin_inet_addr (const char *cp) return res; } +/* exported as inet_aton: BSD 4.3 + inet_aton is not exported by wsock32 and ws2_32, + so it has to be implemented here. */ +extern "C" int +cygwin_inet_aton (const char *cp, struct in_addr *inp) +{ + unsigned long res = inet_addr (cp); + if (res == INADDR_NONE && strcmp (cp, "255.255.255.255")) + return -1; + if (inp) + inp->s_addr = res; + return 0; +} + /* undocumented in wsock32.dll */ extern "C" unsigned int WINAPI inet_network (const char *);