diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-30 14:57:51 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-30 14:57:51 (GMT) |
commit | 876a8aba8471fbe03407e0b3af2e44c194942141 (patch) | |
tree | 6393b23c79b1d63c845cc4f06fffecf6444a3c6b /win | |
parent | 59c52ee2fb7fcc819a92861101a8dd4b77c9f606 (diff) | |
parent | f3146e6826308cf112fccc9ac29ab18bca2a6071 (diff) | |
download | tcl-876a8aba8471fbe03407e0b3af2e44c194942141.zip tcl-876a8aba8471fbe03407e0b3af2e44c194942141.tar.gz tcl-876a8aba8471fbe03407e0b3af2e44c194942141.tar.bz2 |
[Bug 3508771] load tclreg.dll in cygwin tclsh
Implement TclWinGetTclInstance, TclpGetTZName,
and various others for Cygwin
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinError.c | 32 | ||||
-rw-r--r-- | win/tclWinSock.c | 8 |
2 files changed, 23 insertions, 17 deletions
diff --git a/win/tclWinError.c b/win/tclWinError.c index b49271e..d3126b1 100644 --- a/win/tclWinError.c +++ b/win/tclWinError.c @@ -13,14 +13,6 @@ #include "tclInt.h" #include "tclPort.h" -#ifndef WSAEWOULDBLOCK -# define WSAEWOULDBLOCK 10035L -#endif - -#ifndef __WIN32__ -# define DWORD unsigned int -#endif - /* * The following table contains the mapping from Win32 errors to errno errors. */ @@ -341,6 +333,11 @@ static CONST int wsaErrorTable[] = { EREMOTE /* WSAEREMOTE */ }; +#ifdef __CYGWIN__ +# include <windows.h> +# define DWORD unsigned int +#endif + /* *---------------------------------------------------------------------- * @@ -362,7 +359,12 @@ TclWinConvertError( DWORD errCode) /* Win32 error code. */ { if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) { - Tcl_SetErrno(EINVAL); + errCode -= WSAEWOULDBLOCK; + if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) { + Tcl_SetErrno(errorTable[1]); + } else { + Tcl_SetErrno(wsaErrorTable[errCode]); + } } else { Tcl_SetErrno(errorTable[errCode]); } @@ -388,11 +390,15 @@ void TclWinConvertWSAError( DWORD errCode) /* Win32 error code. */ { - errCode -= WSAEWOULDBLOCK; - if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) { - Tcl_SetErrno(EINVAL); + if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) { + errCode -= WSAEWOULDBLOCK; + if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) { + Tcl_SetErrno(errorTable[1]); + } else { + Tcl_SetErrno(wsaErrorTable[errCode]); + } } else { - Tcl_SetErrno(wsaErrorTable[errCode]); + Tcl_SetErrno(errorTable[errCode]); } } diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 1bf4f97..2973db1 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2480,7 +2480,7 @@ InitializeHostName( int TclWinGetSockOpt( - int s, + SOCKET s, int level, int optname, char * optval, @@ -2496,12 +2496,12 @@ TclWinGetSockOpt( return SOCKET_ERROR; } - return getsockopt((SOCKET)s, level, optname, optval, optlen); + return getsockopt(s, level, optname, optval, optlen); } int TclWinSetSockOpt( - int s, + SOCKET s, int level, int optname, const char * optval, @@ -2517,7 +2517,7 @@ TclWinSetSockOpt( return SOCKET_ERROR; } - return setsockopt((SOCKET)s, level, optname, optval, optlen); + return setsockopt(s, level, optname, optval, optlen); } u_short |