openbsd-ports/lang/ghc/patches/patch-libraries_base_cbits_PrelIOUtils_c

42 lines
1.1 KiB
Plaintext
Raw Normal View History

$OpenBSD: patch-libraries_base_cbits_PrelIOUtils_c,v 1.2 2011/04/11 14:30:33 kili Exp $
2010-04-22 17:49:37 -04:00
We have very limited locale support so used latin1 as default codeset
which can be overridden by the environment variable `HS_ENCODING'.
--- libraries/base/cbits/PrelIOUtils.c.orig Sun Dec 19 13:14:39 2010
+++ libraries/base/cbits/PrelIOUtils.c Sun Dec 19 13:18:39 2010
@@ -24,28 +24,14 @@ void debugBelch2(const char*s, char *t)
debugBelch(s,t);
}
2010-04-22 17:49:37 -04:00
-#if defined(HAVE_LIBCHARSET)
-# include <libcharset.h>
-#elif defined(HAVE_LANGINFO_H)
-# include <langinfo.h>
-#endif
-
#if !defined(mingw32_HOST_OS)
2010-04-22 17:49:37 -04:00
+#include <stdlib.h>
+#include <string.h>
const char* localeEncoding(void)
2010-04-22 17:49:37 -04:00
{
-#if defined(HAVE_LIBCHARSET)
- return locale_charset();
-
-#elif defined(HAVE_LANGINFO_H)
2010-04-22 17:49:37 -04:00
- return nl_langinfo(CODESET);
-
-#else
-#warning Depending on the unportable behavior of GNU iconv due to absence of both libcharset and langinfo.h
- /* GNU iconv accepts "" to mean the current locale's
- * encoding. Warning: This isn't portable.
- */
- return "";
-#endif
2010-04-22 17:49:37 -04:00
+ char *l;
+ l = getenv("HS_ENCODING");
+ return l != NULL ? l : "latin1";
}
#endif