summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>1999-12-23 18:24:31 +0000
committersheldonh <sheldonh@FreeBSD.org>1999-12-23 18:24:31 +0000
commit3bc63b4b30beb304ed622f0dae79f2b4b3ef2293 (patch)
tree3b58f61146fe4d0cdb3e9975b81ce53c7181162d
parent68e129ddaa589edd643e5a01e88d11fb5ba55a0e (diff)
downloadFreeBSD-src-3bc63b4b30beb304ed622f0dae79f2b4b3ef2293.zip
FreeBSD-src-3bc63b4b30beb304ed622f0dae79f2b4b3ef2293.tar.gz
Fix zero-padding for printf formats which include a precision or
width. This is a vendor-supplied patch. Requested by: bde Submitted by: Aharon Robbins <arnold@skeeve.com>
-rw-r--r--contrib/awk/builtin.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/awk/builtin.c b/contrib/awk/builtin.c
index 0fee054..3de6f2e 100644
--- a/contrib/awk/builtin.c
+++ b/contrib/awk/builtin.c
@@ -463,7 +463,13 @@ check_pos:
break;
case '0':
- zero_flag = TRUE;
+ /*
+ * Only turn on zero_flag if we haven't seen
+ * the field width or precision yet. Otherwise,
+ * screws up floating point formatting.
+ */
+ if (cur == & fw)
+ zero_flag = TRUE;
if (lj)
goto retry;
/* FALL through */
@@ -2006,7 +2012,7 @@ NODE *tree;
free_temp(tmp);
if (do_lint) {
- if (uval < 0)
+ if (d < 0)
warning("compl(%lf): negative value will give strange results", d);
if (double_to_int(d) != d)
warning("compl(%lf): fractional value will be truncated", d);
OpenPOWER on IntegriCloud