diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-24 22:15:31 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-24 22:15:31 +0200 |
commit | 080694ae82635e76992158591b39a06af7363da0 (patch) | |
tree | 454a9361afa2904702baac9b3777fe76e721d7ca /builtin.c | |
parent | 75459887958f5246bc5126261ec92c8f4d366a47 (diff) | |
download | egawk-080694ae82635e76992158591b39a06af7363da0.tar.gz egawk-080694ae82635e76992158591b39a06af7363da0.tar.bz2 egawk-080694ae82635e76992158591b39a06af7363da0.zip |
Further progress on indirect calls of builtins.
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -3000,7 +3000,7 @@ NODE * call_sub_func(const char *name, int nargs) { unsigned int flags = 0; - NODE *tmp; + NODE *regex, *replace; if (name[0] == 'g') { if (name[1] == 'e') @@ -3009,10 +3009,15 @@ call_sub_func(const char *name, int nargs) flags = GSUB; } - tmp = PEEK(1); - if (tmp->type == Node_val) { - flags |= LITERAL; - } + if ((flags == 0 || flags == GSUB) && nargs != 2) + fatal(_("%s: can be called indirectly only with two arguments"), name); + + replace = POP(); + + regex = POP(); /* the regex */ + regex = make_regnode(Node_regex, regex); + PUSH(regex); + PUSH(replace); return do_sub(nargs, flags); } |