50 lines
1.0 KiB
Diff
50 lines
1.0 KiB
Diff
---
|
|
builtins/printf.def | 13 ++++++++++++-
|
|
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
|
|
--- builtins/printf.def
|
|
+++ builtins/printf.def 2022-06-22 06:26:14.069158235 +0000
|
|
@@ -56,6 +56,7 @@ error occurs.
|
|
$END
|
|
|
|
#include <config.h>
|
|
+#include <locale.h>
|
|
|
|
#include "../bashtypes.h"
|
|
|
|
@@ -702,7 +703,7 @@ printf_builtin (list)
|
|
case 'A':
|
|
#endif
|
|
{
|
|
- char *f;
|
|
+ char *f, *lce = getenv("LC_NUMERIC"), *lcl = setlocale(LC_NUMERIC, NULL);
|
|
|
|
if (use_Lmod || posixly_correct == 0)
|
|
{
|
|
@@ -710,7 +711,12 @@ printf_builtin (list)
|
|
|
|
p = getfloatmax ();
|
|
f = mklong (start, "L", 1);
|
|
+
|
|
+ if (lce && lcl) setlocale(LC_NUMERIC, lce);
|
|
+
|
|
PF (f, p);
|
|
+
|
|
+ if (lce && lcl) setlocale(LC_NUMERIC, lcl);
|
|
}
|
|
else /* posixly_correct */
|
|
{
|
|
@@ -718,7 +724,12 @@ printf_builtin (list)
|
|
|
|
p = getdouble ();
|
|
f = mklong (start, "", 0);
|
|
+
|
|
+ if (lce && lcl) setlocale(LC_NUMERIC, lce);
|
|
+
|
|
PF (f, p);
|
|
+
|
|
+ if (lce && lcl) setlocale(LC_NUMERIC, lcl);
|
|
}
|
|
|
|
break;
|