From aeb470def92ecf2af567ffb027097c99a6cb2d2b Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 28 Feb 2019 20:27:20 -0500 Subject: fix outputing 0 --- src/nonstd/_printf.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/nonstd/_printf.h b/src/nonstd/_printf.h index 95a4c94c..31b2d82e 100644 --- a/src/nonstd/_printf.h +++ b/src/nonstd/_printf.h @@ -38,6 +38,10 @@ static void __itos(char *s, intmax_t n, int flags, int precision, int base) } *out = '\0'; out--; + if (n == 0) { + *out = '0'; + out--; + } while (n > 0) { precision--; *out = digits[n % base]; -- cgit v1.2.1