From 89e724650cad8c62a652585c486ad9558d3e221a Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Thu, 19 May 1988 18:00:59 -0800 Subject: [PATCH] if precision is specified, 0 flag is ignored for diouXx conversions also, print out padding characters for special case 0 value, 0 precision SCCS-vsn: lib/libc/stdio/vfprintf.c 5.26 --- usr/src/lib/libc/stdio/vfprintf.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/usr/src/lib/libc/stdio/vfprintf.c b/usr/src/lib/libc/stdio/vfprintf.c index 0eb7f590de..f24636c9d1 100644 --- a/usr/src/lib/libc/stdio/vfprintf.c +++ b/usr/src/lib/libc/stdio/vfprintf.c @@ -11,7 +11,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)vfprintf.c 5.25 (Berkeley) %G%"; +static char sccsid[] = "@(#)vfprintf.c 5.26 (Berkeley) %G%"; #endif /* LIBC_SCCS and not lint */ #include @@ -247,13 +247,22 @@ rflag: switch (*++fmt) { /* unsigned conversions */ nosign: sign = NULL; + /* + * ``... diouXx conversions ... if a precision is + * specified, the 0 flag will be ignored.'' + * -- ANSI X3J11 + */ +number: if (prec >= 0) + padc = ' '; /* * ``The result of converting a zero value with an * explicit precision of zero is no characters.'' * -- ANSI X3J11 */ -number: if (!_ulong && !prec) - break; + if (!_ulong && !prec) { + size = 0; + goto pforw; + } t = buf + BUF - 1; do { -- 2.20.1