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)
commit3628c71caa5cc745e75c919fbf02240131221386 (patch)
tree6ac609393630b9f07c7b780d4904bdfd374d3b1c /win/tclWinSock.c
parent78bbbde35c3f53764827e54afe963af4ea244aa4 (diff)
parent68d4dd76ebfda8029af039e6f6fd403ca851ce21 (diff)
downloadtcl-3628c71caa5cc745e75c919fbf02240131221386.zip
tcl-3628c71caa5cc745e75c919fbf02240131221386.tar.gz
tcl-3628c71caa5cc745e75c919fbf02240131221386.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,