about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-03-18 18:01:54 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-03-18 18:01:54 -0700
commit32b4cb0e73cdb01c467a0484e906d28d7c104c64 (patch)
tree660b953e22bdb465731eef4af087beaf028a85ae /Src
parent0b00462644a79194d67f87397548df8ff0c6c2c5 (diff)
downloadzsh-32b4cb0e73cdb01c467a0484e906d28d7c104c64.tar.gz
zsh-32b4cb0e73cdb01c467a0484e906d28d7c104c64.tar.xz
zsh-32b4cb0e73cdb01c467a0484e906d28d7c104c64.zip
34734: further aliasing adjustments and doc
restrict token aliasing (34641) to global aliases; tighten up POSIX_ALIASES to better match spec; update Aliasing doc to cover this and clarify older behavior

2015-03-18  Peter Stephenson  <p.stephenson@samsung.com>

	* 34723: configure.ac: turn off fixed site function directory if
Diffstat (limited to 'Src')
-rw-r--r--Src/lex.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 494ea8870..1eb0bc7d7 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1740,12 +1740,13 @@ checkalias(void)
 
     if (!noaliases && isset(ALIASESOPT) &&
 	(!isset(POSIXALIASES) ||
-	 !reswdtab->getnode(reswdtab, zshlextext))) {
+	 (tok == STRING && !reswdtab->getnode(reswdtab, zshlextext)))) {
 	char *suf;
 
 	an = (Alias) aliastab->getnode(aliastab, zshlextext);
 	if (an && !an->inuse &&
-	    ((an->node.flags & ALIAS_GLOBAL) || incmdpos || inalmore)) {
+	    ((an->node.flags & ALIAS_GLOBAL) ||
+	     (incmdpos && tok == STRING) || inalmore)) {
 	    inpush(an->text, INP_ALIAS, an);
 	    if (an->text[0] == ' ' && !(an->node.flags & ALIAS_GLOBAL))
 		aliasspaceflag = 1;
@@ -1784,6 +1785,8 @@ exalias(void)
     if (!tokstr) {
 	zshlextext = tokstrings[tok];
 
+	if (tok == NEWLIN)
+	    return 0;
 	return checkalias();
     } else {
 	VARARR(char, copy, (strlen(tokstr) + 1));
@@ -1791,6 +1794,9 @@ exalias(void)
 	if (has_token(tokstr)) {
 	    char *p, *t;
 
+	    if (isset(POSIXALIASES))
+		return 0;
+
 	    zshlextext = p = copy;
 	    for (t = tokstr;
 		 (*p++ = itok(*t) ? ztokens[*t++ - Pound] : *t++););