summaryrefslogtreecommitdiff
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-02-17 08:20:19 +0200
committerArnold D. Robbins <arnold@skeeve.com>2017-02-17 08:20:19 +0200
commit9acc5c7442feff44445a4c5ae9f618d879064cb4 (patch)
treedfea3de0fea709dcc511b6e715d1b790eb48b498 /builtin.c
parentf5870138fe92a9abb5c4407a77c8ac782936173e (diff)
parent4ce031ad3c3d157a425f721688a09a7dde018619 (diff)
downloadgawk-9acc5c7442feff44445a4c5ae9f618d879064cb4.tar.gz
Merge branch 'master' into feature/stringfix
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 a6082ee0..4d816687 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4001,7 +4001,7 @@ NODE *
do_typeof(int nargs)
{
NODE *arg;
- char *res = "unknown";
+ char *res = NULL;
bool deref = true;
arg = POP();
@@ -4013,9 +4013,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;
@@ -4025,14 +4022,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;