Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2006-07-07 13:14:15 +0400
committerCorinna Vinschen <corinna@vinschen.de>2006-07-07 13:14:15 +0400
commit722031140add9bf3d88f634bff99c53dde0967dc (patch)
treebd0b748a25d7681a3defe649abd1529bf10b129c /winsup/cygwin/net.cc
parentb4054e770675ff388d3fcbca41e8e3233f0a7ac1 (diff)
* Makefile.in (DLL_OFILES): Add inet_addr.o and inet_network.o.
* autoload.cc (inet_addr): Drop definition. (inet_ntoa): Ditto. * net.cc: Forward declare cygwin_inet_aton and cygwin_inet_ntop. (cygwin_inet_ntoa): Call cygwin_inet_ntop instead of Winsock inet_ntoa. (cygwin_inet_addr): Remove here. (cygwin_inet_aton): Ditto. (cygwin_inet_network): Ditto. * libc/inet_addr.c: New file implementing cygwin_inet_aton and cygwin_inet_addr. * libc/inet_network.c: New file implementing cygwin_inet_network.
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r--winsup/cygwin/net.cc45
1 files changed, 4 insertions, 41 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 585653457..7db6c1abb 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -48,6 +48,8 @@ extern "C"
int __stdcall rcmd (char **ahost, unsigned short inport, char *locuser,
char *remuser, char *cmd, SOCKET * fd2p);
int sscanf (const char *, const char *, ...);
+ int cygwin_inet_aton(const char *, struct in_addr *);
+ const char *cygwin_inet_ntop (int, const void *, char *, socklen_t);
} /* End of "C" section */
static fhandler_socket *
@@ -102,7 +104,8 @@ ntohs (unsigned short x)
extern "C" char *
cygwin_inet_ntoa (struct in_addr in)
{
- char *res = inet_ntoa (in);
+ char buf[20];
+ const char *res = cygwin_inet_ntop (AF_INET, &in, buf, sizeof buf);
if (_my_tls.locals.ntoa_buf)
{
@@ -114,46 +117,6 @@ cygwin_inet_ntoa (struct in_addr in)
return _my_tls.locals.ntoa_buf;
}
-/* exported as inet_addr: BSD 4.3 */
-extern "C" unsigned long
-cygwin_inet_addr (const char *cp)
-{
- myfault efault;
- if (efault.faulted (EFAULT))
- return INADDR_NONE;
- unsigned long res = inet_addr (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)
-{
- myfault efault;
- if (efault.faulted (EFAULT))
- return 0;
-
- unsigned long res = inet_addr (cp);
-
- if (res == INADDR_NONE && strcmp (cp, "255.255.255.255"))
- return 0;
- if (inp)
- inp->s_addr = res;
- return 1;
-}
-
-extern "C" unsigned int
-cygwin_inet_network (const char *cp)
-{
- myfault efault;
- if (efault.faulted (EFAULT))
- return INADDR_NONE;
- return ntohl (inet_addr (cp));
-}
-
/* inet_netof is in the standard BSD sockets library. It is useless
for modern networks, since it assumes network values which are no
longer meaningful, but some existing code calls it. */