aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-04-13 10:19:18 +0300
committerArnold D. Robbins <arnold@skeeve.com>2011-04-13 10:19:18 +0300
commit338600c0115fa68fe85c4d601e85bf16965d3a91 (patch)
tree01257b03d23a3303d4d7df20eed4232a270874ac /builtin.c
parent933418a5f59d54887c43dc4fb9167faf1330db30 (diff)
downloadegawk-338600c0115fa68fe85c4d601e85bf16965d3a91.tar.gz
egawk-338600c0115fa68fe85c4d601e85bf16965d3a91.tar.bz2
egawk-338600c0115fa68fe85c4d601e85bf16965d3a91.zip
Bug fixes, see ChangeLog.
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/builtin.c b/builtin.c
index 8349e639..d4dfb20d 100644
--- a/builtin.c
+++ b/builtin.c
@@ -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"));