summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
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,