From: Thomas Leonard Date: Wed, 1 Jul 2015 09:24:50 +0000 (+0100) Subject: Accept %z in printf formats X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e6e91f5c2fac25d5f497efa70e7ffb7bdf4987b0;p=people%2Fliuw%2Flibxenctrl-split%2Fmini-os.git Accept %z in printf formats Before, we only supported %Z (upper-case). It seems that the lower-case version is standard, and this matches the behaviour of Xen's vsprintf.c. Signed-off-by: Thomas Leonard Acked-by: Samuel Thibault --- diff --git a/lib/printf.c b/lib/printf.c index 3d02e95..40f92fc 100644 --- a/lib/printf.c +++ b/lib/printf.c @@ -346,12 +346,14 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) /* get the conversion qualifier */ qualifier = -1; - if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') { + if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z' || *fmt == 'z') { qualifier = *fmt; ++fmt; if (qualifier == 'l' && *fmt == 'l') { qualifier = 'L'; ++fmt; + } else if (qualifier == 'z') { + qualifier = 'Z'; } } if (*fmt == 'q') {