comparison 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
comparison
equal deleted inserted replaced
409:301b9ebbdf3b 410:de805c49cfc1
655 { 655 {
656 strcat (constructed_spec, "."); 656 strcat (constructed_spec, ".");
657 long_to_string (constructed_spec + strlen (constructed_spec), 657 long_to_string (constructed_spec + strlen (constructed_spec),
658 spec->precision); 658 spec->precision);
659 } 659 }
660 sprintf (constructed_spec + strlen (constructed_spec), "%c", ch);
661 660
662 /* sprintf the mofo */ 661 /* sprintf the mofo */
663 /* we have to use separate calls to sprintf(), rather than 662 /* we have to use separate calls to sprintf(), rather than
664 a single big conditional, because of the different types 663 a single big conditional, because of the different types
665 of the arguments */ 664 of the arguments */
666 if (strchr (double_converters, ch)) 665 if (strchr (double_converters, ch))
667 sprintf (text_to_print, constructed_spec, arg.d); 666 {
667 sprintf (constructed_spec + strlen (constructed_spec),
668 "%c", ch);
669 sprintf (text_to_print, constructed_spec, arg.d);
670 }
668 else if (strchr (unsigned_int_converters, ch)) 671 else if (strchr (unsigned_int_converters, ch))
669 { 672 {
673 sprintf (constructed_spec + strlen (constructed_spec),
674 "%c", ch);
670 if (spec->l_flag) 675 if (spec->l_flag)
671 sprintf (text_to_print, constructed_spec, arg.ul); 676 sprintf (text_to_print, constructed_spec, arg.ul);
672 else 677 else
673 sprintf (text_to_print, constructed_spec, arg.ui); 678 sprintf (text_to_print, constructed_spec, arg.ui);
674 } 679 }
675 else 680 else
676 { 681 {
682 if (spec->zero_flag && spec->minwidth)
683 sprintf (constructed_spec + strlen (constructed_spec),
684 "0%d%c", spec->minwidth, ch);
685 else
686 sprintf (constructed_spec + strlen (constructed_spec),
687 "%c", ch);
677 if (spec->l_flag) 688 if (spec->l_flag)
678 sprintf (text_to_print, constructed_spec, arg.l); 689 sprintf (text_to_print, constructed_spec, arg.l);
679 else 690 else
680 sprintf (text_to_print, constructed_spec, arg.i); 691 sprintf (text_to_print, constructed_spec, arg.i);
681 } 692 }