diff options
author | Stefan Jahn <stefan@lkcc.org> | 2001-11-07 15:08:45 +0000 |
---|---|---|
committer | Stefan Jahn <stefan@lkcc.org> | 2001-11-07 15:08:45 +0000 |
commit | b4e15479e93409413bb1dab28c53d9e80302b1ee (patch) | |
tree | 83649098cc7caa865dccfac0ff6309b9cc8c1a43 /libguile/error.c | |
parent | 2ca222c2e93e3cd58ad95b984feb2c74d0310284 (diff) | |
download | guile-b4e15479e93409413bb1dab28c53d9e80302b1ee.tar.gz |
2001-11-07 Stefan Jahn <stefan@lkcc.org>
* configure.in: Include `win32-socket.o' in the list of object
files if networking is enabled on Win32.
2001-11-07 Stefan Jahn <stefan@lkcc.org>
* win32-socket.[ch]: New files. Defines Winsock-API error codes
and makes them available through Guile. That is because the
Winsock-API does not store its errors in `errno' and thus cannot
return error messages via `strerror (errno)'.
* socket.c (scm_init_socket): Initialize `win32-socket' part
here under M$-Windows.
* numbers.h: Added missing declaration of
`scm_sys_check_number_conversions()'.
* error.c: Local definition of SCM_I_STRERROR and SCM_I_ERRNO
and use in `(strerror)' and `(system-error)'.
* Makefile.am (EXTRA_libguile_la_SOURCES): Added
`win32-socket.[ch]' to extra source and header files.
Diffstat (limited to 'libguile/error.c')
-rw-r--r-- | libguile/error.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libguile/error.c b/libguile/error.c index fd9b2a0d9..e17231f88 100644 --- a/libguile/error.c +++ b/libguile/error.c @@ -151,6 +151,17 @@ SCM_DEFINE (scm_error_scm, "scm-error", 5, 0, 0, } #undef FUNC_NAME +#ifdef __MINGW32__ +# include "win32-socket.h" +# define SCM_I_STRERROR(err) \ + ((err >= WSABASEERR) ? scm_i_socket_strerror (err) : strerror (err)) +# define SCM_I_ERRNO() \ + (errno ? errno : scm_i_socket_errno ()) +#else +# define SCM_I_STRERROR(err) strerror (err) +# define SCM_I_ERRNO() errno +#endif /* __MINGW32__ */ + SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0, (SCM err), "Return the Unix error message corresponding to @var{err}, which\n" @@ -158,7 +169,7 @@ SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0, #define FUNC_NAME s_scm_strerror { SCM_VALIDATE_INUM (1,err); - return scm_makfrom0str (strerror (SCM_INUM (err))); + return scm_makfrom0str (SCM_I_STRERROR (SCM_INUM (err))); } #undef FUNC_NAME @@ -166,12 +177,12 @@ SCM_GLOBAL_SYMBOL (scm_system_error_key, "system-error"); void scm_syserror (const char *subr) { - int save_errno = errno; + int save_errno = SCM_I_ERRNO (); scm_error (scm_system_error_key, subr, "~A", - scm_cons (scm_makfrom0str (strerror (save_errno)), SCM_EOL), + scm_cons (scm_makfrom0str (SCM_I_STRERROR (save_errno)), SCM_EOL), scm_cons (SCM_MAKINUM (save_errno), SCM_EOL)); } |