summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-22 12:44:36 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-22 12:44:36 (GMT)
commit0db5ef521489368fde7298d7d4179aa01e9fcc01 (patch)
tree547f1279c0ce411de4125eaac91a118af4215da5 /win
parenta6a7e5ca7699ad328ed645c207aaba8b69e32a53 (diff)
parent6f812b4ccb74d0aebe4bbf520bd6710fa82cf549 (diff)
downloadtcl-0db5ef521489368fde7298d7d4179aa01e9fcc01.zip
tcl-0db5ef521489368fde7298d7d4179aa01e9fcc01.tar.gz
tcl-0db5ef521489368fde7298d7d4179aa01e9fcc01.tar.bz2
Revert most of [fcc5957e59], 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')
-rw-r--r--win/Makefile.in14
-rw-r--r--win/tclWinSock.c28
2 files changed, 29 insertions, 13 deletions
diff --git a/win/Makefile.in b/win/Makefile.in
index d3c9c80..1b7d21f 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -558,7 +558,7 @@ install-binaries: binaries
else true; \
fi; \
done;
- @for i in dde1.3 reg1.2; \
+ @for i in dde$(DDEDOTVER) reg$(REGDOTVER); \
do \
if [ ! -d $(LIB_INSTALL_DIR)/$$i ] ; then \
echo "Making directory $(LIB_INSTALL_DIR)/$$i"; \
@@ -582,23 +582,23 @@ install-binaries: binaries
done
@if [ -f $(DDE_DLL_FILE) ]; then \
echo installing $(DDE_DLL_FILE); \
- $(COPY) $(DDE_DLL_FILE) $(LIB_INSTALL_DIR)/dde1.3; \
+ $(COPY) $(DDE_DLL_FILE) $(LIB_INSTALL_DIR)/dde$(DDEDOTVER); \
$(COPY) $(ROOT_DIR)/library/dde/pkgIndex.tcl \
- $(LIB_INSTALL_DIR)/dde1.3; \
+ $(LIB_INSTALL_DIR)/dde$(DDEDOTVER); \
fi
@if [ -f $(DDE_LIB_FILE) ]; then \
echo installing $(DDE_LIB_FILE); \
- $(COPY) $(DDE_LIB_FILE) $(LIB_INSTALL_DIR)/dde1.3; \
+ $(COPY) $(DDE_LIB_FILE) $(LIB_INSTALL_DIR)/dde$(DDEDOTVER); \
fi
@if [ -f $(REG_DLL_FILE) ]; then \
echo installing $(REG_DLL_FILE); \
- $(COPY) $(REG_DLL_FILE) $(LIB_INSTALL_DIR)/reg1.2; \
+ $(COPY) $(REG_DLL_FILE) $(LIB_INSTALL_DIR)/reg$(REGDOTVER); \
$(COPY) $(ROOT_DIR)/library/reg/pkgIndex.tcl \
- $(LIB_INSTALL_DIR)/reg1.2; \
+ $(LIB_INSTALL_DIR)/reg$(REGDOTVER); \
fi
@if [ -f $(REG_LIB_FILE) ]; then \
echo installing $(REG_LIB_FILE); \
- $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg1.2; \
+ $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg$(REGDOTVER); \
fi
install-libraries: libraries install-tzdata install-msgs
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 019d8e9..9591163 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -1129,7 +1129,7 @@ CreateSocketAddress(
ZeroMemory(sockaddrPtr, sizeof(SOCKADDR_IN));
sockaddrPtr->sin_family = AF_INET;
- sockaddrPtr->sin_port = htons((u_short) (port & 0xFFFF));
+ sockaddrPtr->sin_port = htons((unsigned short) (port & 0xFFFF));
if (host == NULL) {
addr.s_addr = INADDR_ANY;
} else {
@@ -2512,9 +2512,25 @@ TclWinSetSockOpt(SOCKET s, int level, int optname, const char *optval,
return setsockopt(s, level, optname, optval, optlen);
}
-u_short
-TclWinNToHS(
- u_short netshort)
+unsigned short
+TclWinNToHS(unsigned short netshort)
+{
+ /*
+ * 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 (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
@@ -2523,10 +2539,10 @@ TclWinNToHS(
*/
if (!SocketsEnabled()) {
- return (u_short) -1;
+ return NULL;
}
- return ntohs(netshort);
+ return inet_ntoa(addr);
}
struct servent *