X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrerror-override.c;fp=lib%2Fstrerror-override.c;h=4f8cda536613443c8229aa3f5a0158e6ef93fcf4;hb=c7b1d210ecf7281224cd9f35dce03dc043225310;hp=c2ca764eb46dc8ab031d3797ced3e1a028c31623;hpb=2dbdfc4b6f524d0d35151ec175010c497609318a;p=gnulib.git diff --git a/lib/strerror-override.c b/lib/strerror-override.c index c2ca764eb..4f8cda536 100644 --- a/lib/strerror-override.c +++ b/lib/strerror-override.c @@ -34,147 +34,94 @@ const char * strerror_override (int errnum) { - const char *msg = NULL; - -#if GNULIB_defined_ETXTBSY \ - || GNULIB_defined_ESOCK \ - || GNULIB_defined_ENOMSG \ - || GNULIB_defined_EIDRM \ - || GNULIB_defined_ENOLINK \ - || GNULIB_defined_EPROTO \ - || GNULIB_defined_EMULTIHOP \ - || GNULIB_defined_EBADMSG \ - || GNULIB_defined_EOVERFLOW \ - || GNULIB_defined_ENOTSUP \ - || GNULIB_defined_ESTALE \ - || GNULIB_defined_EDQUOT \ - || GNULIB_defined_ECANCELED /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ switch (errnum) { -# if GNULIB_defined_ETXTBSY +#if GNULIB_defined_ETXTBSY case ETXTBSY: - msg = "Text file busy"; - break; -# endif + return "Text file busy"; +#endif -# if GNULIB_defined_ESOCK /* native Windows platforms */ +#if GNULIB_defined_ESOCK /* native Windows platforms */ /* EWOULDBLOCK is the same as EAGAIN. */ case EINPROGRESS: - msg = "Operation now in progress"; - break; + return "Operation now in progress"; case EALREADY: - msg = "Operation already in progress"; - break; + return "Operation already in progress"; case ENOTSOCK: - msg = "Socket operation on non-socket"; - break; + return "Socket operation on non-socket"; case EDESTADDRREQ: - msg = "Destination address required"; - break; + return "Destination address required"; case EMSGSIZE: - msg = "Message too long"; - break; + return "Message too long"; case EPROTOTYPE: - msg = "Protocol wrong type for socket"; - break; + return "Protocol wrong type for socket"; case ENOPROTOOPT: - msg = "Protocol not available"; - break; + return "Protocol not available"; case EPROTONOSUPPORT: - msg = "Protocol not supported"; - break; + return "Protocol not supported"; case ESOCKTNOSUPPORT: - msg = "Socket type not supported"; - break; + return "Socket type not supported"; case EOPNOTSUPP: - msg = "Operation not supported"; - break; + return "Operation not supported"; case EPFNOSUPPORT: - msg = "Protocol family not supported"; - break; + return "Protocol family not supported"; case EAFNOSUPPORT: - msg = "Address family not supported by protocol"; - break; + return "Address family not supported by protocol"; case EADDRINUSE: - msg = "Address already in use"; - break; + return "Address already in use"; case EADDRNOTAVAIL: - msg = "Cannot assign requested address"; - break; + return "Cannot assign requested address"; case ENETDOWN: - msg = "Network is down"; - break; + return "Network is down"; case ENETUNREACH: - msg = "Network is unreachable"; - break; + return "Network is unreachable"; case ENETRESET: - msg = "Network dropped connection on reset"; - break; + return "Network dropped connection on reset"; case ECONNABORTED: - msg = "Software caused connection abort"; - break; + return "Software caused connection abort"; case ECONNRESET: - msg = "Connection reset by peer"; - break; + return "Connection reset by peer"; case ENOBUFS: - msg = "No buffer space available"; - break; + return "No buffer space available"; case EISCONN: - msg = "Transport endpoint is already connected"; - break; + return "Transport endpoint is already connected"; case ENOTCONN: - msg = "Transport endpoint is not connected"; - break; + return "Transport endpoint is not connected"; case ESHUTDOWN: - msg = "Cannot send after transport endpoint shutdown"; - break; + return "Cannot send after transport endpoint shutdown"; case ETOOMANYREFS: - msg = "Too many references: cannot splice"; - break; + return "Too many references: cannot splice"; case ETIMEDOUT: - msg = "Connection timed out"; - break; + return "Connection timed out"; case ECONNREFUSED: - msg = "Connection refused"; - break; + return "Connection refused"; case ELOOP: - msg = "Too many levels of symbolic links"; - break; + return "Too many levels of symbolic links"; case EHOSTDOWN: - msg = "Host is down"; - break; + return "Host is down"; case EHOSTUNREACH: - msg = "No route to host"; - break; + return "No route to host"; case EPROCLIM: - msg = "Too many processes"; - break; + return "Too many processes"; case EUSERS: - msg = "Too many users"; - break; + return "Too many users"; case EDQUOT: - msg = "Disk quota exceeded"; - break; + return "Disk quota exceeded"; case ESTALE: - msg = "Stale NFS file handle"; - break; + return "Stale NFS file handle"; case EREMOTE: - msg = "Object is remote"; - break; -# if HAVE_WINSOCK2_H + return "Object is remote"; +# if HAVE_WINSOCK2_H /* WSA_INVALID_HANDLE maps to EBADF */ /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ /* WSA_INVALID_PARAMETER maps to EINVAL */ case WSA_OPERATION_ABORTED: - msg = "Overlapped operation aborted"; - break; + return "Overlapped operation aborted"; case WSA_IO_INCOMPLETE: - msg = "Overlapped I/O event object not in signaled state"; - break; + return "Overlapped I/O event object not in signaled state"; case WSA_IO_PENDING: - msg = "Overlapped operations will complete later"; - break; + return "Overlapped operations will complete later"; /* WSAEINTR maps to EINTR */ /* WSAEBADF maps to EBADF */ /* WSAEACCES maps to EACCES */ @@ -219,127 +166,99 @@ strerror_override (int errnum) /* WSAESTALE is ESTALE */ /* WSAEREMOTE is EREMOTE */ case WSASYSNOTREADY: - msg = "Network subsystem is unavailable"; - break; + return "Network subsystem is unavailable"; case WSAVERNOTSUPPORTED: - msg = "Winsock.dll version out of range"; - break; + return "Winsock.dll version out of range"; case WSANOTINITIALISED: - msg = "Successful WSAStartup not yet performed"; - break; + return "Successful WSAStartup not yet performed"; case WSAEDISCON: - msg = "Graceful shutdown in progress"; - break; + return "Graceful shutdown in progress"; case WSAENOMORE: case WSA_E_NO_MORE: - msg = "No more results"; - break; + return "No more results"; case WSAECANCELLED: case WSA_E_CANCELLED: - msg = "Call was canceled"; - break; + return "Call was canceled"; case WSAEINVALIDPROCTABLE: - msg = "Procedure call table is invalid"; - break; + return "Procedure call table is invalid"; case WSAEINVALIDPROVIDER: - msg = "Service provider is invalid"; - break; + return "Service provider is invalid"; case WSAEPROVIDERFAILEDINIT: - msg = "Service provider failed to initialize"; - break; + return "Service provider failed to initialize"; case WSASYSCALLFAILURE: - msg = "System call failure"; - break; + return "System call failure"; case WSASERVICE_NOT_FOUND: - msg = "Service not found"; - break; + return "Service not found"; case WSATYPE_NOT_FOUND: - msg = "Class type not found"; - break; + return "Class type not found"; case WSAEREFUSED: - msg = "Database query was refused"; - break; + return "Database query was refused"; case WSAHOST_NOT_FOUND: - msg = "Host not found"; - break; + return "Host not found"; case WSATRY_AGAIN: - msg = "Nonauthoritative host not found"; - break; + return "Nonauthoritative host not found"; case WSANO_RECOVERY: - msg = "Nonrecoverable error"; - break; + return "Nonrecoverable error"; case WSANO_DATA: - msg = "Valid name, no data record of requested type"; - break; + return "Valid name, no data record of requested type"; /* WSA_QOS_* omitted */ -# endif # endif +#endif -# if GNULIB_defined_ENOMSG +#if GNULIB_defined_ENOMSG case ENOMSG: - msg = "No message of desired type"; - break; -# endif + return "No message of desired type"; +#endif -# if GNULIB_defined_EIDRM +#if GNULIB_defined_EIDRM case EIDRM: - msg = "Identifier removed"; - break; -# endif + return "Identifier removed"; +#endif -# if GNULIB_defined_ENOLINK +#if GNULIB_defined_ENOLINK case ENOLINK: - msg = "Link has been severed"; - break; -# endif + return "Link has been severed"; +#endif -# if GNULIB_defined_EPROTO +#if GNULIB_defined_EPROTO case EPROTO: - msg = "Protocol error"; - break; -# endif + return "Protocol error"; +#endif -# if GNULIB_defined_EMULTIHOP +#if GNULIB_defined_EMULTIHOP case EMULTIHOP: - msg = "Multihop attempted"; - break; -# endif + return "Multihop attempted"; +#endif -# if GNULIB_defined_EBADMSG +#if GNULIB_defined_EBADMSG case EBADMSG: - msg = "Bad message"; - break; -# endif + return "Bad message"; +#endif -# if GNULIB_defined_EOVERFLOW +#if GNULIB_defined_EOVERFLOW case EOVERFLOW: - msg = "Value too large for defined data type"; - break; -# endif + return "Value too large for defined data type"; +#endif -# if GNULIB_defined_ENOTSUP +#if GNULIB_defined_ENOTSUP case ENOTSUP: - msg = "Not supported"; - break; -# endif + return "Not supported"; +#endif -# if GNULIB_defined_ESTALE +#if GNULIB_defined_ESTALE case ESTALE: - msg = "Stale NFS file handle"; - break; -# endif + return "Stale NFS file handle"; +#endif -# if GNULIB_defined_EDQUOT +#if GNULIB_defined_EDQUOT case EDQUOT: - msg = "Disk quota exceeded"; - break; -# endif + return "Disk quota exceeded"; +#endif -# if GNULIB_defined_ECANCELED +#if GNULIB_defined_ECANCELED case ECANCELED: - msg = "Operation canceled"; - break; -# endif - } + return "Operation canceled"; #endif - return msg; + default: + return NULL; + } }