From 061c1ce9129b3d34e8cf386633bbcc54110bd569 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Wed, 28 Feb 2001 09:12:54 +0000 Subject: add `aliases' option to be able to disable alias expansion (13554) --- Src/Zle/compcore.c | 4 ++-- Src/Zle/compctl.c | 7 ++++--- Src/Zle/zle_tricky.c | 9 +++++---- Src/lex.c | 2 +- Src/options.c | 1 + Src/zsh.h | 1 + 6 files changed, 14 insertions(+), 10 deletions(-) (limited to 'Src') diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index 715e4ffc1..887557f40 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -1237,7 +1237,7 @@ set_comp_sep(void) LinkNode n; int owe = we, owb = wb, ocs = cs, swb, swe, scs, soffs, ne = noerrs; int tl, got = 0, i = 0, cur = -1, oll = ll, sl, remq; - int ois = instring, oib = inbackt, noffs = lp; + int ois = instring, oib = inbackt, noffs = lp, ona = noaliases; char *tmp, *p, *ns, *ol = (char *) line, sav, *qp, *qs, *ts, qc = '\0'; s += lip; @@ -1299,7 +1299,7 @@ set_comp_sep(void) } i++; } while (tok != ENDINPUT && tok != LEXERR); - noaliases = 0; + noaliases = ona; strinend(); inpop(); errflag = zleparse = 0; diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c index 44bf73700..56de52e46 100644 --- a/Src/Zle/compctl.c +++ b/Src/Zle/compctl.c @@ -2753,7 +2753,7 @@ sep_comp_string(char *ss, char *s, int noffs) LinkNode n; int owe = we, owb = wb, ocs = cs, swb, swe, scs, soffs, ne = noerrs; int sl = strlen(ss), tl, got = 0, i = 0, cur = -1, oll = ll, remq; - int ois = instring, oib = inbackt; + int ois = instring, oib = inbackt, ona = noaliases; char *tmp, *p, *ns, *ol = (char *) line, sav, *oaq = autoq, *qp, *qs; char *ts, qc = '\0'; @@ -2813,7 +2813,7 @@ sep_comp_string(char *ss, char *s, int noffs) } i++; } while (tok != ENDINPUT && tok != LEXERR); - noaliases = 0; + noaliases = ona; strinend(); inpop(); errflag = zleparse = 0; @@ -3648,6 +3648,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) LinkList foo = newlinklist(); LinkNode n; int first = 1, ng = opts[NULLGLOB], oowe = we, oowb = wb; + int ona = noaliases; char *tmpbuf; opts[NULLGLOB] = 1; @@ -3669,7 +3670,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) addlinknode(foo, ztrdup(tokstr)); first = 0; } while (tok != ENDINPUT && tok != LEXERR); - noaliases = 0; + noaliases = ona; strinend(); inpop(); errflag = zleparse = 0; diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index e97bd1f6d..31556041c 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -964,6 +964,7 @@ static char * get_comp_string(void) { int t0, tt0, i, j, k, cp, rd, sl, ocs, ins, oins, ia, parct, varq = 0; + int ona = noaliases; char *s = NULL, *linptr, *tmp, *p, *tt = NULL; freebrinfo(brbeg); @@ -1236,12 +1237,12 @@ get_comp_string(void) addedx = 0; goto start; } - noaliases = 0; + noaliases = ona; lexrestore(); return NULL; } - noaliases = 0; + noaliases = ona; /* Check if we are in an array subscript. We simply assume that * * we are in a subscript if we are in brackets. Correct solution * @@ -2138,7 +2139,7 @@ int doexpandhist(void) { unsigned char *ol; - int oll, ocs, ne = noerrs, err; + int oll, ocs, ne = noerrs, err, ona = noaliases; pushheap(); metafy_line(); @@ -2165,7 +2166,7 @@ doexpandhist(void) * means that the expanded string is unusable. */ err = errflag; noerrs = ne; - noaliases = 0; + noaliases = ona; strinend(); inpop(); zleparse = 0; diff --git a/Src/lex.c b/Src/lex.c index 9a066b915..322bb9abe 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -1556,7 +1556,7 @@ exalias(void) if (tok == STRING) { /* Check for an alias */ - an = noaliases ? NULL : + an = (noaliases || unset(ALIASESOPT)) ? NULL : (Alias) aliastab->getnode(aliastab, yytext); if (an && !an->inuse && ((an->flags & ALIAS_GLOBAL) || incmdpos || inalmore)) { diff --git a/Src/options.c b/Src/options.c index 8660ade68..7223b1d59 100644 --- a/Src/options.c +++ b/Src/options.c @@ -69,6 +69,7 @@ mod_export HashTable optiontab; * to avoid formatting problems. */ static struct optname optns[] = { +{NULL, "aliases", OPT_EMULATE|OPT_ALL, ALIASESOPT}, {NULL, "allexport", OPT_EMULATE, ALLEXPORT}, {NULL, "alwayslastprompt", OPT_ALL, ALWAYSLASTPROMPT}, {NULL, "alwaystoend", 0, ALWAYSTOEND}, diff --git a/Src/zsh.h b/Src/zsh.h index 1d332f16c..bfc9052b6 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1305,6 +1305,7 @@ struct histent { enum { OPT_INVALID, + ALIASESOPT, ALLEXPORT, ALWAYSLASTPROMPT, ALWAYSTOEND, -- cgit 1.4.1