diff src/doprnt.c @ 410:de805c49cfc1 r21-2-35

Import from CVS: tag r21-2-35
author cvs
date Mon, 13 Aug 2007 11:19:21 +0200
parents 74fd4e045ea6
children 697ef44129c6
line wrap: on
line diff
--- a/src/doprnt.c	Mon Aug 13 11:18:12 2007 +0200
+++ b/src/doprnt.c	Mon Aug 13 11:19:21 2007 +0200
@@ -657,16 +657,21 @@
 		  long_to_string (constructed_spec + strlen (constructed_spec),
 				  spec->precision);
 		}
-	      sprintf (constructed_spec + strlen (constructed_spec), "%c", ch);
 
 	      /* sprintf the mofo */
 	      /* we have to use separate calls to sprintf(), rather than
 		 a single big conditional, because of the different types
 		 of the arguments */
 	      if (strchr (double_converters, ch))
-		sprintf (text_to_print, constructed_spec, arg.d);
+		{
+		  sprintf (constructed_spec + strlen (constructed_spec),
+			   "%c", ch);
+		  sprintf (text_to_print, constructed_spec, arg.d);
+		}
 	      else if (strchr (unsigned_int_converters, ch))
 		{
+		  sprintf (constructed_spec + strlen (constructed_spec),
+			   "%c", ch);
 		  if (spec->l_flag)
 		    sprintf (text_to_print, constructed_spec, arg.ul);
 		  else
@@ -674,6 +679,12 @@
 		}
 	      else
 		{
+		  if (spec->zero_flag && spec->minwidth)
+		    sprintf (constructed_spec + strlen (constructed_spec),
+			     "0%d%c", spec->minwidth, ch);
+		  else
+		    sprintf (constructed_spec + strlen (constructed_spec),
+			     "%c", ch);
 		  if (spec->l_flag)
 		    sprintf (text_to_print, constructed_spec, arg.l);
 		  else