Patch for printf's "%If"

Hamed Malek hamed@bamdad.org
Fri Dec 19 15:24:00 GMT 2003


On Thu, 18 Dec 2003, Ulrich Drepper wrote:

> 
> Hamed Malek wrote:
> > Attached is a patch for "%If" (and other similar) format strings to work
> > with printf and other such functions.
> 
> Looks OK, I've applied it.  Now, how about some test cases which fit
> into the glibc test suite?
> 
I added some lines to tst-printf.c to check i18n flag on 'e', 'f', 'g' and 
'd' formats. (Attached)

Hamed Malek

-------------- next part --------------
--- glibc-2.3.2-200310040752/stdio-common/tst-printf.c	2003-11-22 15:21:44.000000000 +0330
+++ glibc-2.3.2-200310040752/stdio-common/tst-printf2.c	2003-12-19 18:13:59.000000000 +0330
@@ -164,7 +164,8 @@
   printf("left-adjusted ZLDN:\t\"%-010ld\"\n", -123456L);
   printf("space-padded LDN:\t\"%10ld\"\n", -123456L);
   printf("left-adjusted SLDN:\t\"%-10ld\"\n", -123456L);
-
+  printf("outdigit decimal number:\t\"%Id\"\n", 2345);
+ 
   printf("zero-padded string:\t\"%010s\"\n", shortstr);
   printf("left-adjusted Z string:\t\"%-010s\"\n", shortstr);
   printf("space-padded string:\t\"%10s\"\n", shortstr);
@@ -177,14 +178,17 @@
   printf("e-style < .1:\t\"%e\"\n", 0.001234);
   printf("e-style big:\t\"%.60e\"\n", 1e20);
   printf ("e-style == .1:\t\"%e\"\n", 0.1);
+  printf("e-style outdigit:\t\"%Ie\"\n",12.34); 
   printf("f-style >= 1:\t\"%f\"\n", 12.34);
   printf("f-style >= .1:\t\"%f\"\n", 0.1234);
   printf("f-style < .1:\t\"%f\"\n", 0.001234);
+  printf("f-style outdigit:\t\"%If\"\n",12.34); 
   printf("g-style >= 1:\t\"%g\"\n", 12.34);
   printf("g-style >= .1:\t\"%g\"\n", 0.1234);
   printf("g-style < .1:\t\"%g\"\n", 0.001234);
   printf("g-style big:\t\"%.60g\"\n", 1e20);
-
+  printf("g-style outdigit:\t\"%Ig\"\n",12.34); 
+ 
   printf (" %6.5f\n", .099999999860301614);
   printf (" %6.5f\n", .1);
   printf ("x%5.4fx\n", .5);


More information about the Libc-alpha mailing list