bash-custom-action/bash-3.2-printf.patch
OBS User autobuild de0f1815fa Accepting request 18772 from Base:System
Copy from Base:System/bash based on submit request 18772 from user coolo

OBS-URL: https://build.opensuse.org/request/show/18772
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/bash?expand=0&rev=43
2009-08-28 15:45:57 +00:00

35 lines
687 B
Diff

Index: builtins/printf.def
===================================================================
--- builtins/printf.def.orig
+++ builtins/printf.def
@@ -47,6 +47,7 @@ error occurs.
$END
#include <config.h>
+#include <locale.h>
#include "../bashtypes.h"
@@ -529,12 +530,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;
}