*
*/
+#if defined __linux__
+/* Force GNU strerror_r prototype instead of Posix prototype */
+# define _GNU_SOURCE
+#endif
+
#include <errno.h>
#include <string.h>
#include <locale.h>
ASSERT(p != NULL);
return p;
}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * Err_Errno2LocalString --
- *
- * Returns a localized string in UTF-8 that corresponds to the
- * passed error number.
- *
- * XXX doesn't actually work
- *
- * Results:
- * Allocated error message string, caller must free.
- * NULL on failure.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-char *
-Err_Errno2LocalString(Err_Number errorNumber) // IN
-{
- /*
- * XXX The version of glibc (2.2.x) we use doesn't support
- * uselocal() or strerror_l(), and we can't set LC_MESSAGES
- * globally, so we can't implement this function.
- * Instead, we return NULL and the upper level code
- * (Msg_LocalizeList1) generates some sort of message.
- * We can't do that here because it would require using
- * Msg_Format, which is a layer violation (and a linking
- * problem).
- */
-
-#if 0
- // XXX need to cache newLocale if we ever actually use this code
- locale_t newLocale = newlocale(1 << LC_MESSAGES, NULL, NULL);
- locale_t oldLocale = uselocale(newLocale);
- char buf[2048];
- char *p;
-
- p = strerror_r(errorNumber, buf, sizeof buf);
- ASSERT_NOT_IMPLEMENTED(p != NULL);
- uselocale(oldLocale);
- return Util_SafeStrdup(p);
-#else
- return NULL;
-#endif
-}