diff options
author | ache <ache@FreeBSD.org> | 2001-02-10 06:49:53 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-02-10 06:49:53 +0000 |
commit | 1f66809615027cac4ac8cfafe2f5875107060cbf (patch) | |
tree | d9e50d9252798a567ca903a6a166d50dca38fee8 /usr.bin/printf | |
parent | 772e4b2ef9865ff24f1902516c258301cc162d74 (diff) | |
download | FreeBSD-src-1f66809615027cac4ac8cfafe2f5875107060cbf.zip FreeBSD-src-1f66809615027cac4ac8cfafe2f5875107060cbf.tar.gz |
Localize it (LC_NUMERIC)
Diffstat (limited to 'usr.bin/printf')
-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 '?': |