aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
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"));