diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-18 22:01:19 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-18 22:01:19 +0200 |
commit | b062ba39d52c7e9dee06ac73030aba248ee81168 (patch) | |
tree | 643eef948b5b3ef7a07154c8fb5567ee535e1702 /builtin.c | |
parent | e29498dcb6a94edadf3d3ad3f631331c7ee40a33 (diff) | |
download | egawk-b062ba39d52c7e9dee06ac73030aba248ee81168.tar.gz egawk-b062ba39d52c7e9dee06ac73030aba248ee81168.tar.bz2 egawk-b062ba39d52c7e9dee06ac73030aba248ee81168.zip |
Make @/.../ a terminal. Improve typeof() builtin function.
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -3685,6 +3685,7 @@ do_typeof(int nargs) { NODE *arg; char *res = "unknown"; + int null_str_flags = (STRCUR|STRING|NUMCUR|NUMBER); arg = POP(); switch (arg->type) { @@ -3696,7 +3697,9 @@ do_typeof(int nargs) break; case Node_val: case Node_var: - if ((arg->flags & STRING) != 0) + if ((arg->flags & null_str_flags) == null_str_flags) + res = "untyped"; + else if ((arg->flags & STRING) != 0) res = "scalar_s"; else if ((arg->flags & NUMBER) != 0) res = "scalar_n"; |