This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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]

[PATCH] Make strfmon() more POSIX-compliant


Here is a patch to fix another problem with strfmon().  At the moment
there are two issues I know of with this function when it comes to
POSIX compliance.  This patch fixes the only one of these that I plan
to fix.  The last one I believe is an error in the POSIX standard
examples, and not glibc (See
<URL:http://sources.redhat.com/ml/libc-alpha/2003-09/msg00163.html>
for some info on the remaining issue).

Anyway, this one should fix the issue described in
<URL:http://sources.redhat.com/ml/libc-alpha/2003-06/msg00258.html>.
Please include in the next version of glibc.

Entry for libc/Changelog:

2004-01-01  Petter Reinholdtsen  <pere@hungry.com>

	* stdlib/strfmon.c: Make formatting of left-justified currency
	values match the the POSIX standard.  When using format string
	"[%-14#5.4n]" to print -123.45, the result should be
	"[-$   123.4500 ]", not "[-$123.4500    ]".

Entry for libc/localedata/Changelog:

2004-01-01  Petter Reinholdtsen  <pere@hungry.com>

	* tst-fmon.data: Add simple test to check left justified currency
	values in the C locale.

Index: stdlib/strfmon.c
===================================================================
RCS file: /cvs/glibc/libc/stdlib/strfmon.c,v
retrieving revision 1.24
diff -u -3 -p -u -r1.24 strfmon.c
--- stdlib/strfmon.c	5 Dec 2003 09:50:14 -0000	1.24
+++ stdlib/strfmon.c	1 Jan 2004 12:45:12 -0000
@@ -570,7 +573,7 @@ __strfmon_l (char *s, size_t maxsize, __
       info.is_long = 0;
       info.alt = 0;
       info.space = 0;
-      info.left = left;
+      info.left = 0;
       info.showsign = 0;
       info.group = group;
       info.pad = pad;
Index: localedata/tst-fmon.data
===================================================================
RCS file: /cvs/glibc/libc/localedata/tst-fmon.data,v
retrieving revision 1.11
diff -u -3 -p -u -r1.11 tst-fmon.data
--- localedata/tst-fmon.data	5 Dec 2003 09:47:25 -0000	1.11
+++ localedata/tst-fmon.data	1 Jan 2004 12:45:12 -0000
@@ -44,6 +44,9 @@ C			%#9n	1.23		         1.23
 C			%#9n	-1.23		-        1.23
 C			%=*#9n	1.23		 ********1.23
 C			%=*#9n	-1.23		-********1.23
+C			%-14#5.4n	1.23	"     1.2300   "
+C			%-14#5.4n	-1.23	"-    1.2300   "
+C			%-14#5.4n	123.45	"   123.4500   "
 #
 # check both the german locale and strfmon with that data
 #


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