1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-19 00:10:56 +01:00

zsh-workers/9777

This commit is contained in:
Tanaka Akira 2000-02-17 14:44:51 +00:00
parent 9aa1735b63
commit 493876e0c7
5 changed files with 22 additions and 17 deletions

View file

@ -2219,7 +2219,7 @@ gen_matches_files(int dirs, int execs, int all)
/* Do the globbing... */ /* Do the globbing... */
remnulargs(p); remnulargs(p);
addlinknode(l, p); addlinknode(l, p);
globlist(l); globlist(l, 0);
/* And see if that produced a filename. */ /* And see if that produced a filename. */
tt = nonempty(l); tt = nonempty(l);
while (ugetnode(l)); while (ugetnode(l));
@ -3334,7 +3334,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
tokenize(p); tokenize(p);
remnulargs(p); remnulargs(p);
addlinknode(l, p); addlinknode(l, p);
globlist(l); globlist(l, 0);
if (nonempty(l)) { if (nonempty(l)) {
/* And add the resulting words. */ /* And add the resulting words. */
@ -3483,7 +3483,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
/* Do the globbing. */ /* Do the globbing. */
ng = opts[NULLGLOB]; ng = opts[NULLGLOB];
opts[NULLGLOB] = 1; opts[NULLGLOB] = 1;
globlist(l); globlist(l, 0);
opts[NULLGLOB] = ng; opts[NULLGLOB] = ng;
/* Get the results. */ /* Get the results. */
if (nonempty(l) && peekfirst(l)) { if (nonempty(l) && peekfirst(l)) {
@ -3679,7 +3679,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
/* Fine, now do full expansion. */ /* Fine, now do full expansion. */
prefork(foo, 0); prefork(foo, 0);
if (!errflag) { if (!errflag) {
globlist(foo); globlist(foo, 0);
if (!errflag) if (!errflag)
/* And add the resulting words as matches. */ /* And add the resulting words as matches. */
for (n = firstnode(foo); n; incnode(n)) for (n = firstnode(foo); n; incnode(n))

View file

@ -1612,11 +1612,11 @@ doexpansion(char *s, int lst, int olst, int explincmd)
prefork(vl, 0); prefork(vl, 0);
if (errflag) if (errflag)
goto end; goto end;
if ((lst == COMP_LIST_EXPAND) || (lst == COMP_EXPAND)) { if (lst == COMP_LIST_EXPAND || lst == COMP_EXPAND) {
int ng = opts[NULLGLOB]; int ng = opts[NULLGLOB];
opts[NULLGLOB] = 1; opts[NULLGLOB] = 1;
globlist(vl); globlist(vl, 1);
opts[NULLGLOB] = ng; opts[NULLGLOB] = ng;
} }
if (errflag) if (errflag)
@ -1645,11 +1645,14 @@ doexpansion(char *s, int lst, int olst, int explincmd)
foredel(we - wb); foredel(we - wb);
while ((ss = (char *)ugetnode(vl))) { while ((ss = (char *)ugetnode(vl))) {
ret = 0; ret = 0;
untokenize(ss);
ss = quotename(ss, NULL); ss = quotename(ss, NULL);
untokenize(ss);
inststr(ss); inststr(ss);
#if 0
if (olst != COMP_EXPAND_COMPLETE || nonempty(vl) || if (olst != COMP_EXPAND_COMPLETE || nonempty(vl) ||
(cs && line[cs-1] != '/')) { (cs && line[cs-1] != '/')) {
#endif
if (nonempty(vl)) {
spaceinline(1); spaceinline(1);
line[cs++] = ' '; line[cs++] = ' ';
} }

View file

@ -1419,7 +1419,7 @@ addvars(Estate state, Wordcode pc, int export)
return; return;
} }
if (isset(GLOBASSIGN) || !isstr) if (isset(GLOBASSIGN) || !isstr)
globlist(vl); globlist(vl, 0);
if (errflag) { if (errflag) {
state->pc = opc; state->pc = opc;
return; return;
@ -1520,7 +1520,7 @@ execsubst(LinkList strs)
prefork(strs, esprefork); prefork(strs, esprefork);
if (esglob) { if (esglob) {
LinkList ostrs = strs; LinkList ostrs = strs;
globlist(strs); globlist(strs, 0);
strs = ostrs; strs = ostrs;
} }
} }
@ -1644,7 +1644,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
if (!(cflags & BINF_NOGLOB)) if (!(cflags & BINF_NOGLOB))
while (!checked && !errflag && args && nonempty(args) && while (!checked && !errflag && args && nonempty(args) &&
has_token((char *) peekfirst(args))) has_token((char *) peekfirst(args)))
glob(args, firstnode(args)); glob(args, firstnode(args), 0);
else if (!unglobbed) { else if (!unglobbed) {
for (node = firstnode(args); node; incnode(node)) for (node = firstnode(args); node; incnode(node))
untokenize((char *) getdata(node)); untokenize((char *) getdata(node));
@ -1927,7 +1927,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
if ((esglob = !(cflags & BINF_NOGLOB)) && args) { if ((esglob = !(cflags & BINF_NOGLOB)) && args) {
LinkList oargs = args; LinkList oargs = args;
globlist(args); globlist(args, 0);
args = oargs; args = oargs;
} }
if (errflag) { if (errflag) {

View file

@ -872,7 +872,7 @@ gmatchcmp(Gmatch a, Gmatch b)
/**/ /**/
void void
glob(LinkList list, LinkNode np) glob(LinkList list, LinkNode np, int nountok)
{ {
struct qual *qo, *qn, *ql; struct qual *qo, *qn, *ql;
LinkNode node = prevnode(np); LinkNode node = prevnode(np);
@ -887,7 +887,8 @@ glob(LinkList list, LinkNode np)
MUSTUSEHEAP("glob"); MUSTUSEHEAP("glob");
if (unset(GLOBOPT) || !haswilds(ostr)) { if (unset(GLOBOPT) || !haswilds(ostr)) {
untokenize(ostr); if (!nountok)
untokenize(ostr);
return; return;
} }
save_globstate(saved); save_globstate(saved);
@ -1339,7 +1340,8 @@ glob(LinkList list, LinkNode np)
if (!q || errflag) { /* if parsing failed */ if (!q || errflag) { /* if parsing failed */
restore_globstate(saved); restore_globstate(saved);
if (unset(BADPATTERN)) { if (unset(BADPATTERN)) {
untokenize(ostr); if (!nountok)
untokenize(ostr);
insertlinknode(list, node, ostr); insertlinknode(list, node, ostr);
return; return;
} }
@ -1578,7 +1580,7 @@ xpandredir(struct redir *fn, LinkList tab)
prefork(fake, isset(MULTIOS) ? 0 : PF_SINGLE); prefork(fake, isset(MULTIOS) ? 0 : PF_SINGLE);
/* Globbing is only done for multios. */ /* Globbing is only done for multios. */
if (!errflag && isset(MULTIOS)) if (!errflag && isset(MULTIOS))
globlist(fake); globlist(fake, 0);
if (errflag) if (errflag)
return 0; return 0;
if (nonempty(fake) && !nextnode(firstnode(fake))) { if (nonempty(fake) && !nextnode(firstnode(fake))) {

View file

@ -212,14 +212,14 @@ stringsubst(LinkList list, LinkNode node, int ssub)
/**/ /**/
mod_export void mod_export void
globlist(LinkList list) globlist(LinkList list, int nountok)
{ {
LinkNode node, next; LinkNode node, next;
badcshglob = 0; badcshglob = 0;
for (node = firstnode(list); !errflag && node; node = next) { for (node = firstnode(list); !errflag && node; node = next) {
next = nextnode(node); next = nextnode(node);
glob(list, node); glob(list, node, nountok);
} }
if (badcshglob == 1) if (badcshglob == 1)
zerr("no match", NULL, 0); zerr("no match", NULL, 0);