summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-24 10:54:50 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-24 10:54:50 (GMT)
commitdfe42eb574aa00b5653a4388eb77a2039c432e1b (patch)
tree6ac609393630b9f07c7b780d4904bdfd374d3b1c /win/tclWinSock.c
parent3f7682214c0c92aa733384a9cc8936d45c5d9259 (diff)
parentdce46c947bd11b68d1979b9e708d177acfddb911 (diff)
downloadtcl-dfe42eb574aa00b5653a4388eb77a2039c432e1b.zip
tcl-dfe42eb574aa00b5653a4388eb77a2039c432e1b.tar.gz
tcl-dfe42eb574aa00b5653a4388eb77a2039c432e1b.tar.bz2
Revert most of [3caedf05df], since when we let cygwin share the win32 stub table this is no longer necessary
implement TclpInetNtoa for win32 Let cygwin share stub table with win32
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r--win/tclWinSock.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 7181701..f0c2251 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -2663,9 +2663,9 @@ TclWinSetSockOpt(
return setsockopt(s, level, optname, optval, optlen);
}
-u_short
+unsigned short
TclWinNToHS(
- u_short netshort)
+ unsigned short netshort)
{
/*
* Check that WinSock is initialized; do not call it if not, to prevent
@@ -2674,12 +2674,29 @@ TclWinNToHS(
*/
if (!SocketsEnabled()) {
- return (u_short) -1;
+ return (unsigned short) -1;
}
return ntohs(netshort);
}
+char *
+TclpInetNtoa(
+ struct in_addr addr)
+{
+ /*
+ * Check that WinSock is initialized; do not call it if not, to prevent
+ * system crashes. This can happen at exit time if the exit handler for
+ * WinSock ran before other exit handlers that want to use sockets.
+ */
+
+ if (!SocketsEnabled()) {
+ return NULL;
+ }
+
+ return inet_ntoa(addr);
+}
+
struct servent *
TclWinGetServByName(
const char *name,