tiny-printf: Support %i
authorMarek Vasut <marex@denx.de>
Fri, 10 Apr 2020 18:54:49 +0000 (20:54 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 1 May 2020 15:03:24 +0000 (11:03 -0400)
The most basic printf("%i", value) formating string was missing,
add it for the sake of convenience.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
lib/tiny-printf.c

index 1138c7012aee50c4928f953c4d1d24852b659115..8fc7e48d9942178d07c4e3ef76283ad4011e04d9 100644 (file)
@@ -242,6 +242,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
                                goto abort;
                        case 'u':
                        case 'd':
+                       case 'i':
                                div = 1000000000;
                                if (islong) {
                                        num = va_arg(va, unsigned long);
@@ -251,7 +252,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
                                        num = va_arg(va, unsigned int);
                                }
 
-                               if (ch == 'd') {
+                               if (ch != 'u') {
                                        if (islong && (long)num < 0) {
                                                num = -(long)num;
                                                out(info, '-');