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/tclWinError.c | |
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/tclWinError.c')
-rw-r--r-- | win/tclWinError.c | 32 |
1 files changed, 19 insertions, 13 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]); } } |