summaryrefslogtreecommitdiffstats
path: root/contrib/awk
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>1999-12-22 14:59:58 +0000
committersheldonh <sheldonh@FreeBSD.org>1999-12-22 14:59:58 +0000
commit946d89ae2629e07c7d4735eac8d1f5ac2263ce58 (patch)
treea5f0c24dd676d43a4b876e6ce26e218349c5ad9b /contrib/awk
parentb725e888cf822f521a9b7e26005b40c6d57beda4 (diff)
downloadFreeBSD-src-946d89ae2629e07c7d4735eac8d1f5ac2263ce58.zip
FreeBSD-src-946d89ae2629e07c7d4735eac8d1f5ac2263ce58.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>
Diffstat (limited to 'contrib/awk')
-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 a4e5a08..00ff757 100644
--- a/contrib/awk/builtin.c
+++ b/contrib/awk/builtin.c
@@ -459,7 +459,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 */
@@ -1998,7 +2004,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