diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/printf/printf.1 | 3 | ||||
-rw-r--r-- | usr.bin/printf/printf.c | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/usr.bin/printf/printf.1 b/usr.bin/printf/printf.1 index 5e6c940..2d510c3 100644 --- a/usr.bin/printf/printf.1 +++ b/usr.bin/printf/printf.1 @@ -250,6 +250,9 @@ precision is 0 or missing, all characters in the string are printed. Print a `%'; no argument is used. .El .Pp +The decimal point +character is defined in the program's locale (category LC_NUMERIC). +.Pp In no case does a non-existent or small field width cause truncation of a field; padding takes place only if the specified field width exceeds the actual width. diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index 4b01b4a..897a063 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -67,6 +67,10 @@ static const char rcsid[] = #define warnx3(a, b, c) warnx(a, b, c) #endif +#ifndef BUILTIN +#include <locale.h> +#endif + #define PF(f, func) { \ char *b = NULL; \ if (fieldwidth) \ @@ -109,6 +113,9 @@ main(argc, argv) int ch, end, fieldwidth, precision; char convch, nextch, *format, *fmt, *start; +#ifndef BUILTIN + (void) setlocale(LC_NUMERIC, ""); +#endif while ((ch = getopt(argc, argv, "")) != -1) switch (ch) { case '?': |