1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 16:40:24 +02:00

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.
This commit is contained in:
Peter Stephenson 2017-01-10 19:14:26 +00:00
parent b088b67a54
commit bb218704d2
8 changed files with 129 additions and 6 deletions

View file

@ -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;
}