aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-02-17 08:19:35 +0200
committerArnold D. Robbins <arnold@skeeve.com>2017-02-17 08:19:35 +0200
commit81d1407331ba872f18d47f16de8339c510ed1008 (patch)
tree2e89246b229eb7fde813409d21fdb199da0edadc /builtin.c
parent512c96f284f5179b895ccc9c24b22d12ccc1b0f8 (diff)
parent4ce031ad3c3d157a425f721688a09a7dde018619 (diff)
downloadegawk-81d1407331ba872f18d47f16de8339c510ed1008.tar.gz
egawk-81d1407331ba872f18d47f16de8339c510ed1008.tar.bz2
egawk-81d1407331ba872f18d47f16de8339c510ed1008.zip
Merge branch 'master' into feature/api-mpfr
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/builtin.c b/builtin.c
index f4104764..394319ba 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3977,7 +3977,7 @@ NODE *
do_typeof(int nargs)
{
NODE *arg;
- char *res = "unknown";
+ char *res = NULL;
bool deref = true;
arg = POP();
@@ -3989,9 +3989,6 @@ do_typeof(int nargs)
break;
case Node_val:
switch (fixtype(arg)->flags & (STRING|NUMBER|USER_INPUT|REGEX)) {
- case STRING:
- res = "string";
- break;
case NUMBER:
res = "number";
break;
@@ -4001,14 +3998,20 @@ do_typeof(int nargs)
case REGEX:
res = "regexp";
break;
+ case STRING:
+ res = "string";
+ // fall through
case NUMBER|STRING:
- if (arg == Nnull_string) {
+ if (arg == Nnull_string || (arg->flags & NULL_FIELD) != 0) {
res = "unassigned";
break;
}
/* fall through */
default:
- warning(_("typeof detected invalid flags combination `%s'; please file a bug report."), flags2str(arg->flags));
+ if (res == NULL) {
+ warning(_("typeof detected invalid flags combination `%s'; please file a bug report."), flags2str(arg->flags));
+ res = "unknown";
+ }
break;
}
break;