Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
356:e85f639a32f3 | 357:4711e16a8e49 |
---|---|
631 | 631 |
632 else | 632 else |
633 { | 633 { |
634 char text_to_print[500]; | 634 char text_to_print[500]; |
635 char constructed_spec[100]; | 635 char constructed_spec[100]; |
636 int tem; | |
636 | 637 |
637 /* Partially reconstruct the spec and use sprintf() to | 638 /* Partially reconstruct the spec and use sprintf() to |
638 format the string. */ | 639 format the string. */ |
639 | 640 |
640 /* Make sure nothing stupid happens */ | 641 /* Make sure nothing stupid happens */ |
655 { | 656 { |
656 strcat (constructed_spec, "."); | 657 strcat (constructed_spec, "."); |
657 long_to_string (constructed_spec + strlen (constructed_spec), | 658 long_to_string (constructed_spec + strlen (constructed_spec), |
658 spec->precision); | 659 spec->precision); |
659 } | 660 } |
660 sprintf (constructed_spec + strlen (constructed_spec), "%c", ch); | 661 sprintf (constructed_spec + (tem = strlen (constructed_spec)), "%c", ch); |
661 | 662 |
662 /* sprintf the mofo */ | 663 /* sprintf the mofo */ |
663 /* we have to use separate calls to sprintf(), rather than | 664 /* we have to use separate calls to sprintf(), rather than |
664 a single big conditional, because of the different types | 665 a single big conditional, because of the different types |
665 of the arguments */ | 666 of the arguments */ |
672 else | 673 else |
673 sprintf (text_to_print, constructed_spec, arg.ui); | 674 sprintf (text_to_print, constructed_spec, arg.ui); |
674 } | 675 } |
675 else | 676 else |
676 { | 677 { |
678 /* In the special case of zero padding a signed integer */ | |
679 /* with a field width specified, we overwrite the default */ | |
680 /* format. */ | |
681 if (spec->zero_flag && spec->minwidth) | |
682 sprintf (constructed_spec + tem, | |
683 "0%d%c", spec->minwidth, ch); | |
677 if (spec->l_flag) | 684 if (spec->l_flag) |
678 sprintf (text_to_print, constructed_spec, arg.l); | 685 sprintf (text_to_print, constructed_spec, arg.l); |
679 else | 686 else |
680 sprintf (text_to_print, constructed_spec, arg.i); | 687 sprintf (text_to_print, constructed_spec, arg.i); |
681 } | 688 } |