From bb218704d27bcca9aa4426296dcd5c13d58b330a Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 10 Jan 2017 19:14:26 +0000 Subject: 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. --- Src/input.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'Src/input.c') 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; +} -- cgit v1.2.3