summarylogtreecommitdiffstats
path: root/0001-nl_langinfo.mingw32.patch
blob: eaf51547fd16b397c7113039e84639e487b3e080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- popt-1.16/poptint.c.orig	2010-01-19 04:39:10 +0400
+++ popt-1.16/poptint.c	2012-05-05 22:02:40 +0400
@@ -86,8 +86,20 @@
     if (istr == NULL)
 	return NULL;
 
-#ifdef HAVE_LANGINFO_H
+#if defined(HAVE_LANGINFO_H)
+#  if !defined(WIN32)
     codeset = nl_langinfo ((nl_item)CODESET);
+#  else
+    {
+      static char __langinfo[251];
+      unsigned int cp = GetACP();
+      if (cp)
+        sprintf(__langinfo, "CP%u", cp);
+      else
+        strcpy(__langinfo, "UTF-8"); /* ? */
+      codeset = __langinfo;
+    }
+#  endif
 #endif
 
     if (codeset != NULL && strcmp(codeset, "UTF-8") != 0
--- popt-1.16/poptint.h.orig	2010-01-19 04:39:10 +0400
+++ popt-1.16/poptint.h	2012-05-05 22:07:21 +0400
@@ -172,7 +173,7 @@
 #endif
 #endif
 
-#ifdef HAVE_LANGINFO_H
+#if defined(HAVE_LANGINFO_H) && !defined(WIN32)
 #include <langinfo.h>
 #if defined(__LCLINT__)
 /*@-declundef -incondefs @*/
@@ -180,6 +181,8 @@
 	/*@*/;
 /*@=declundef =incondefs @*/
 #endif
+#elif defined(WIN32)
+#include <windows.h>
 #endif
 
 #if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)