printf: In d/i/o/u/x/X conversions with a precision specified, the 0 flag should be ignored.

For example, the output of the following should have only two leading zeros (and the rest of the field width padded with spaces):

#include <stdio.h>

int main(void) {
        printf("%016.5i\n", 123);
}
This commit is contained in:
Stephen Heumann 2021-01-30 17:51:55 -06:00
parent 7c4141f03d
commit bd1e822a43
1 changed files with 4 additions and 1 deletions

View File

@ -3640,9 +3640,12 @@ cn3 _Int2Dec
;
~Format_IntOut entry
pd1 lda ~precisionSpecified if the precision was not specified then
bne pd2
bne pd1a
lda #1 use a precision of 1
sta ~precision
bra pd2
pd1a lda #' ' if the precision was specified then
sta ~paddChar do not do 0 padding
pd2 ldx ~precision if the precision is zero then
bne pd2a
lda ~str+l:~str-2 if the result is ' 0' then