Re: errno patches for Windows

2003-10-17 Thread Hrvoje Niksic
Gisle Vanem [EMAIL PROTECTED] writes: #ifndef ENOTCONN # define ENOTCONN X_ENOTCONN #endif Except you cannot make Winsock return X_ENOTCONN. But we don't really care because we're in control of what gets stores into errno after Winsock calls. So instead of: errno = WSAGetLastError ();

Re: errno patches for Windows

2003-10-16 Thread Hrvoje Niksic
[ Moving discussion from wget-patches to wget. ] Gisle Vanem [EMAIL PROTECTED] writes: I'm pretty sure that other GNU applications -- that have also been ported to Windows -- use errno. I wonder how they do it... Lynx uses this: #define SOCKET_ERRNO errno #ifdef WINDOWS #undef

Re: errno patches for Windows

2003-10-16 Thread Gisle Vanem
Hrvoje Niksic [EMAIL PROTECTED] said: OK. So the whole thing with errno is only necessary when dealing with Winsock errors. For errors from, say, fopen it's fine to use errno? Yes. There is another possible approach. We already #define read and write to call Winsock stuff. We could add

Re: errno patches for Windows

2003-10-16 Thread Hrvoje Niksic
Gisle Vanem [EMAIL PROTECTED] writes: There is another possible approach. We already #define read and write to call Winsock stuff. We could add some more magic so that they and other Winsock invocations automatically set errno to last error value, translating Windows errors to errno errors.

Re: errno patches for Windows

2003-10-16 Thread Gisle Vanem
Hrvoje Niksic [EMAIL PROTECTED] said: #ifdef WINDOWS # define select(a, b, c, d) windows_select (a, b, c, d) #endif Okay by me. #ifndef ENOTCONN # define ENOTCONN X_ENOTCONN #endif Except you cannot make Winsock return X_ENOTCONN. It returns WSAENOTCONN (def'ed to ENOTCONN in