From: tomo Date: Tue, 12 Oct 1999 07:55:55 +0000 (+0000) Subject: (emacs_doprnt_1): Fix problem with %0XXd for a negative integer. X-Git-Tag: r21-2-19-utf-2000-0_9-0-doprnt-1~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0680bf5c284a73aaa6e267c4b0f1363d2cb48739;p=chise%2Fxemacs-chise.git- (emacs_doprnt_1): Fix problem with %0XXd for a negative integer. --- diff --git a/src/doprnt.c b/src/doprnt.c index 8259c5a..7df3f9c 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -657,16 +657,24 @@ emacs_doprnt_1 (Lisp_Object stream, CONST Bufbyte *format_nonreloc, long_to_string (constructed_spec + strlen (constructed_spec), spec->precision); } +#if 0 sprintf (constructed_spec + strlen (constructed_spec), "%c", ch); +#endif /* 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 +682,12 @@ emacs_doprnt_1 (Lisp_Object stream, CONST Bufbyte *format_nonreloc, } 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