diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2011-04-13 10:19:18 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2011-04-13 10:19:18 +0300 |
commit | 338600c0115fa68fe85c4d601e85bf16965d3a91 (patch) | |
tree | 01257b03d23a3303d4d7df20eed4232a270874ac /builtin.c | |
parent | 933418a5f59d54887c43dc4fb9167faf1330db30 (diff) | |
download | egawk-338600c0115fa68fe85c4d601e85bf16965d3a91.tar.gz egawk-338600c0115fa68fe85c4d601e85bf16965d3a91.tar.bz2 egawk-338600c0115fa68fe85c4d601e85bf16965d3a91.zip |
Bug fixes, see ChangeLog.
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -798,7 +798,7 @@ do_substr(int nargs) NODE * do_strftime(int nargs) { - NODE *t1, *t2, *ret; + NODE *t1, *t2, *t3, *ret; struct tm *tm; time_t fclock; char *bufp; @@ -830,11 +830,20 @@ do_strftime(int nargs) } } - t1 = t2 = NULL; + t1 = t2 = t3 = NULL; if (nargs > 0) { /* have args */ NODE *tmp; - if (nargs == 2) { + if (nargs == 3) { + t3 = POP_SCALAR(); + if ((t3->flags & (NUMCUR|NUMBER)) != 0) + do_gmt = (t3->numbr != 0); + else + do_gmt = (t3->stlen > 0); + DEREF(t3); + } + + if (nargs >= 2) { t2 = POP_SCALAR(); if (do_lint && (t2->flags & (NUMCUR|NUMBER)) == 0) lintwarn(_("strftime: received non-numeric second argument")); |