Mercurial > hg > xemacs-beta
diff src/doprnt.c @ 357:4711e16a8e49 r21-1-8
Import from CVS: tag r21-1-8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:57:04 +0200 |
parents | 182f72e8cd0d |
children | a4f53d9b3154 |
line wrap: on
line diff
--- a/src/doprnt.c Mon Aug 13 10:56:23 2007 +0200 +++ b/src/doprnt.c Mon Aug 13 10:57:04 2007 +0200 @@ -633,6 +633,7 @@ { char text_to_print[500]; char constructed_spec[100]; + int tem; /* Partially reconstruct the spec and use sprintf() to format the string. */ @@ -657,7 +658,7 @@ long_to_string (constructed_spec + strlen (constructed_spec), spec->precision); } - sprintf (constructed_spec + strlen (constructed_spec), "%c", ch); + sprintf (constructed_spec + (tem = strlen (constructed_spec)), "%c", ch); /* sprintf the mofo */ /* we have to use separate calls to sprintf(), rather than @@ -674,6 +675,12 @@ } else { + /* In the special case of zero padding a signed integer */ + /* with a field width specified, we overwrite the default */ + /* format. */ + if (spec->zero_flag && spec->minwidth) + sprintf (constructed_spec + tem, + "0%d%c", spec->minwidth, ch); if (spec->l_flag) sprintf (text_to_print, constructed_spec, arg.l); else