summaryrefslogtreecommitdiffstats
path: root/SOURCES/bash-3.2-printf.patch
blob: e250c4f7c631ad95e586889c708223e5ad932d1b (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
--- builtins/printf.def
+++ builtins/printf.def	2006-07-27 17:11:19.000000000 +0200
@@ -37,6 +37,7 @@ shell variable VAR rather than being sen
 $END
 
 #include <config.h>
+#include <locale.h>
 
 #include "../bashtypes.h"
 
@@ -501,12 +502,20 @@ printf_builtin (list)
 	    case 'A':
 #endif
 	      {
-		char *f;
+		char *f, *lce = getenv("LC_NUMERIC"), *lcl = setlocale(LC_NUMERIC, NULL);
 		floatmax_t p;
 
 		p = getfloatmax ();
 		f = mklong (start, FLOATMAX_CONV, sizeof(FLOATMAX_CONV) - 1);
+
+		if (lce && lcl)
+		    setlocale(LC_NUMERIC, lce);
+
 		PF (f, p);
+
+		if (lce && lcl)
+		    setlocale(LC_NUMERIC, lcl);
+
 		break;
 	      }