summaryrefslogtreecommitdiffstats
path: root/gettext-0.18.1.1-locale.patch
blob: 6d80e3614687815005235adc657d853b95c3b1e1 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
--- old/gettext-0.18.1.1/gettext-runtime/intl/localename.c	2011-10-15 00:21:37.853133600 -0400
+++ new/gettext-0.18.1.1/gettext-runtime/intl/localename.c	2011-10-15 00:29:27.601133600 -0400
@@ -59,7 +59,7 @@
 # define WIN32_NATIVE
 #endif
 
-#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */
+#if defined WIN32_NATIVE /* WIN32 */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* List of language codes, sorted by value:
@@ -1407,7 +1407,7 @@
 #endif
 
 
-#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */
+#if defined WIN32_NATIVE /* WIN32 */
 
 /* Canonicalize a Win32 native locale name to a Unix locale name.
    NAME is a sufficiently large buffer.
@@ -2770,8 +2770,8 @@
     setting of 'local'."
    However it does not specify the exact format.  Neither do SUSV2 and
    ISO C 99.  So we can use this feature only on selected systems (e.g.
-   those using GNU C Library).  */
-#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2)
+   those using GNU C Library, or cygwin [1.5 and 1.7+]).  */
+#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2) || defined __CYGWIN__
 # define HAVE_LOCALE_NULL
 #endif
 
@@ -2826,11 +2826,6 @@
          Ignore invalid LANG value set by the Terminal application.  */
       if (strcmp (retval, "UTF-8") != 0)
 #endif
-#if defined __CYGWIN__
-      /* Cygwin.
-         Ignore dummy LANG value set by ~/.profile.  */
-      if (strcmp (retval, "C.UTF-8") != 0)
-#endif
         return retval;
     }
 
@@ -2923,7 +2918,7 @@
 
 # endif
 
-# if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */
+# if defined WIN32_NATIVE /* WIN32 */
   {
     LCID lcid;
 
@@ -2933,6 +2928,23 @@
     return gl_locale_name_from_win32_LCID (lcid);
   }
 # endif
+# if defined __CYGWIN__
+  {
+    /* Rarely arrive here. This function is called only when an earlier
+     * call to gl_locale_name_posix() or gl_locale_name_environ()
+     * returned NULL.  That first function now simply delegates to
+     * setlocale (LC_*, NULL), which never fails on cygwin.  But...for
+     * completeness, or when called after gl_locale_name_environ() and
+     * none are set, go ahead and specify the cygwin default. Cheat a bit
+     * to distinguish old cygwin (1.5 and below) from new cygwin (1.7+).
+     */
+#  if PATH_MAX < 261   /* cygwin 1.5 or below */
+    return "C";
+#  else                /* PATH_MAX = 4096, cygwin 1.7 or above */
+    return "C.UTF-8";
+#  endif
+  }
+# endif
 #endif
 }
 
--- old/gettext-0.18.1.1/gettext-tools/gnulib-lib/localename.c	2011-10-15 00:21:37.853133600 -0400
+++ new/gettext-0.18.1.1/gettext-tools/gnulib-lib/localename.c	2011-10-15 00:29:27.601133600 -0400
@@ -59,7 +59,7 @@
 # define WIN32_NATIVE
 #endif
 
-#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */
+#if defined WIN32_NATIVE /* WIN32 */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* List of language codes, sorted by value:
@@ -1407,7 +1407,7 @@
 #endif
 
 
-#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */
+#if defined WIN32_NATIVE /* WIN32 */
 
 /* Canonicalize a Win32 native locale name to a Unix locale name.
    NAME is a sufficiently large buffer.
@@ -2770,8 +2770,8 @@
     setting of 'local'."
    However it does not specify the exact format.  Neither do SUSV2 and
    ISO C 99.  So we can use this feature only on selected systems (e.g.
-   those using GNU C Library).  */
-#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2)
+   those using GNU C Library, or cygwin [1.5 and 1.7+]).  */
+#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2) || defined __CYGWIN__
 # define HAVE_LOCALE_NULL
 #endif
 
@@ -2826,11 +2826,6 @@
          Ignore invalid LANG value set by the Terminal application.  */
       if (strcmp (retval, "UTF-8") != 0)
 #endif
-#if defined __CYGWIN__
-      /* Cygwin.
-         Ignore dummy LANG value set by ~/.profile.  */
-      if (strcmp (retval, "C.UTF-8") != 0)
-#endif
         return retval;
     }
 
@@ -2923,7 +2918,7 @@
 
 # endif
 
-# if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */
+# if defined WIN32_NATIVE /* WIN32 */
   {
     LCID lcid;
 
@@ -2933,6 +2928,23 @@
     return gl_locale_name_from_win32_LCID (lcid);
   }
 # endif
+# if defined __CYGWIN__
+  {
+    /* Rarely arrive here. This function is called only when an earlier
+     * call to gl_locale_name_posix() or gl_locale_name_environ()
+     * returned NULL.  That first function now simply delegates to
+     * setlocale (LC_*, NULL), which never fails on cygwin.  But...for
+     * completeness, or when called after gl_locale_name_environ() and
+     * none are set, go ahead and specify the cygwin default. Cheat a bit
+     * to distinguish old cygwin (1.5 and below) from new cygwin (1.7+).
+     */
+#  if PATH_MAX < 261   /* cygwin 1.5 or below */
+    return "C";
+#  else                /* PATH_MAX = 4096, cygwin 1.7 or above */
+    return "C.UTF-8";
+#  endif
+  }
+# endif
 #endif
 }