This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: *printf fix - ' flag


Patch checked in.

-- Jeff J.

Eric Blake wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

POSIX requires %'d to print a decimal separated by the thousands
separator.  Fortunately for newlib, the thousands separator in the C
locale is the empty string.  I also discovered that my previous patch to
support %zu and friends was incomplete, since it didn't support %1$zu.

2006-11-14 Eric Blake <ebb9@byu.net>

	* libc/stdio/vfprintf.c (_vfprintf_r): Support ' flag.
	(chclass): ' is a flag.  j, t, and z are modifiers.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWcsg84KuGfSFAYARArs7AKCQPyAV61Bkm/vTGAccAicbhvWE+QCeIEjP
q5WVwsWKx7SFuwAPVWJbz7Q=
=1xe6
-----END PGP SIGNATURE-----


------------------------------------------------------------------------


Index: libc/stdio/vfprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/vfprintf.c,v
retrieving revision 1.46
diff -u -p -r1.46 vfprintf.c
--- libc/stdio/vfprintf.c 26 Sep 2006 21:22:19 -0000 1.46
+++ libc/stdio/vfprintf.c 14 Nov 2006 13:54:18 -0000
@@ -610,6 +610,12 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap)
rflag: ch = *fmt++;
reswitch: switch (ch) {
+ case '\'':
+ /* In the C locale, LC_NUMERIC requires
+ thousands_sep to be the empty string. And since
+ no other locales are supported (yet), this flag
+ is currently a no-op. */
+ goto rflag;
case ' ':
/*
* ``If the space and + flags both appear, the space
@@ -1495,7 +1501,7 @@ _CONST static CH_CLASS chclass[256] = {
/* 08-0f */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 10-17 */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 18-1f */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
- /* 20-27 */ FLAG, OTHER, OTHER, FLAG, DOLLAR, OTHER, OTHER, OTHER,
+ /* 20-27 */ FLAG, OTHER, OTHER, FLAG, DOLLAR, OTHER, OTHER, FLAG,
/* 28-2f */ OTHER, OTHER, STAR, FLAG, OTHER, FLAG, DOT, OTHER,
/* 30-37 */ ZERO, DIGIT, DIGIT, DIGIT, DIGIT, DIGIT, DIGIT, DIGIT,
/* 38-3f */ DIGIT, DIGIT, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
@@ -1504,9 +1510,9 @@ _CONST static CH_CLASS chclass[256] = {
/* 50-57 */ OTHER, OTHER, OTHER, SPEC, OTHER, SPEC, OTHER, SPEC, /* 58-5f */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 60-67 */ OTHER, OTHER, OTHER, SPEC, SPEC, SPEC, SPEC, SPEC, - /* 68-6f */ MODFR, SPEC, OTHER, OTHER, MODFR, OTHER, OTHER, SPEC, - /* 70-77 */ SPEC, MODFR, OTHER, SPEC, OTHER, SPEC, OTHER, OTHER,
- /* 78-7f */ SPEC, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
+ /* 68-6f */ MODFR, SPEC, MODFR, OTHER, MODFR, OTHER, OTHER, SPEC, + /* 70-77 */ SPEC, MODFR, OTHER, SPEC, MODFR, SPEC, OTHER, OTHER,
+ /* 78-7f */ SPEC, OTHER, MODFR, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 80-87 */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 88-8f */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 90-97 */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]