aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-14 15:30:33 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-14 15:30:33 -0400
commit56b1798777fe5464014fca3f9744ebdb950b8348 (patch)
tree9817fa39e7dd200921322771c7ba3b84ff4b44a1
parente8ba153719506aabfffc911d2519727a3bfc5a36 (diff)
downloadegawk-56b1798777fe5464014fca3f9744ebdb950b8348.tar.gz
egawk-56b1798777fe5464014fca3f9744ebdb950b8348.tar.bz2
egawk-56b1798777fe5464014fca3f9744ebdb950b8348.zip
Fix strftime 3rd argument to behave like a standard boolean: non-null or non-zero.
-rw-r--r--ChangeLog5
-rw-r--r--builtin.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index a016ca91..87ea1896 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2016-06-14 Andrew J. Schorr <aschorr@telemetry-investments.com>
+ * builtin.c (do_strftime): Fix handling of 3rd argument to work
+ as a standard boolean: non-null or non-zero.
+
+2016-06-14 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
* gawkapi.c (node_to_awk_value): When caller requests AWK_SCALAR
or AWK_UNDEFINED, we need to call fixtype before we check the type.
diff --git a/builtin.c b/builtin.c
index 90a1fa07..ede02474 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1928,9 +1928,9 @@ do_strftime(int nargs)
NODE *tmp;
if (nargs == 3) {
- t3 = POP_SCALAR();
- if ((t3->flags & (NUMCUR|NUMBER)) != 0)
- do_gmt = (t3->numbr != 0);
+ t3 = fixtype(POP_SCALAR());
+ if ((t3->flags & NUMBER) != 0)
+ do_gmt = ! iszero(t3);
else
do_gmt = (t3->stlen > 0);
DEREF(t3);