diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-01-10 19:14:26 +0000 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-01-10 19:14:26 +0000 |
commit | bb218704d27bcca9aa4426296dcd5c13d58b330a (patch) | |
tree | a9644ce52924e524a0e443869585f5286f7261a7 /Src/input.c | |
parent | b088b67a54872a33ea78ef25ee312c8f31e88c71 (diff) | |
download | zsh-bb218704d27bcca9aa4426296dcd5c13d58b330a.tar.gz zsh-bb218704d27bcca9aa4426296dcd5c13d58b330a.tar.xz zsh-bb218704d27bcca9aa4426296dcd5c13d58b330a.zip |
40306 with doc tweaks: Change behaviour expanding alias in () function definition.
Now an error unless the () is part of the same error as the name. Add ALIAS_FUNC_DEF option to allow it again.
Diffstat (limited to 'Src/input.c')
-rw-r--r-- | Src/input.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Src/input.c b/Src/input.c index eb968ea72..92abaec92 100644 --- a/Src/input.c +++ b/Src/input.c @@ -670,3 +670,30 @@ ingetptr(void) { return inbufptr; } + +/* + * Check if the current input line, including continuations, is + * expanding an alias. This does not detect alias expansions that + * have been fully processed and popped from the input stack. + * If there is an alias, the most recently expanded is returned, + * else NULL. + */ + +/**/ +char *input_hasalias(void) +{ + int flags = inbufflags; + struct instacks *instackptr = instacktop; + + for (;;) + { + if (!(flags & INP_CONT)) + break; + instackptr--; + if (instackptr->alias) + return instackptr->alias->node.nam; + flags = instackptr->flags; + } + + return NULL; +} |