--- 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 +#include #include "../bashtypes.h" @@ -132,6 +133,11 @@ extern int errno; vbuf = 0; \ } \ fflush (stdout); \ + if (ferror (stdout)) \ + { \ + clearerr (stdout); \ + return (EXECUTION_FAILURE); \ + } \ return (value); \ } \ while (0) @@ -487,12 +493,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; }