X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=lib%2Fvsprintf.c;h=60874dae3ebd2a922d45a67e4ea9b8ff49dc3528;hb=cd2bf4846c36a225bfffdedda50e5e80c8b2857f;hp=533a96b85e3629a765ba807a594f8509fab9f68a;hpb=1acba3345c6f707195d8f1cbac834436445279b3;p=u-boot diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 533a96b85e..60874dae3e 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -750,6 +750,7 @@ repeat: ADDCH(str, '\0'); if (str > end) end[-1] = '\0'; + --str; } #else *str = '\0'; @@ -870,3 +871,19 @@ char *simple_itoa(ulong i) } while (i > 0); return p + 1; } + +/* We don't seem to have %'d in U-Boot */ +void print_grouped_ull(unsigned long long int_val, int digits) +{ + char str[21], *s; + int grab = 3; + + digits = (digits + 2) / 3; + sprintf(str, "%*llu", digits * 3, int_val); + for (s = str; *s; s += grab) { + if (s != str) + putc(s[-1] != ' ' ? ',' : ' '); + printf("%.*s", grab, s); + grab = 3; + } +}