diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-29 08:00:46 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-29 08:00:46 +0000 |
commit | a2750a4effef1db7966530cd39905dbb7cf2b99c (patch) | |
tree | 0ccf8cc00e18527fe9e59d093c20bcf0dbe812bf /Src/Zle | |
parent | 7a3ca7a673d98fcbe50c192cba6165d17505e394 (diff) | |
download | zsh-a2750a4effef1db7966530cd39905dbb7cf2b99c.tar.gz zsh-a2750a4effef1db7966530cd39905dbb7cf2b99c.tar.xz zsh-a2750a4effef1db7966530cd39905dbb7cf2b99c.zip |
fixes for _arguments with sets; make _zpty not use sets (11624)
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/computil.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index e627f37a2..d8b4f0cb6 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -510,7 +510,8 @@ parse_caarg(int mult, int type, int num, int opt, char *oname, char **def, *p = ':'; } else ret->action = ztrdup(rembslashcolon(p + 1)); - } + } else + ret->action = ztrdup(""); *def = p; return ret; @@ -588,7 +589,7 @@ parse_cadef(char *nam, char **args) /* Now get the -s, -A, -S and -M options. */ args++; - while ((p = *args) && *p == '-') { + while ((p = *args) && *p == '-' && p[1]) { for (q = ++p; *q; q++) if (*q == 'M') { q = ""; @@ -1226,7 +1227,7 @@ ca_parse_line(Cadef d, int multi, int first) Caopt ptr, wasopt, dopt; struct castate state; char *line, *pe, **argxor = NULL; - int cur, doff, argend; + int cur, doff, argend, arglast; Patprog endpat = NULL; /* Free old state. */ @@ -1284,7 +1285,7 @@ ca_parse_line(Cadef d, int multi, int first) line; line = compwords[cur++]) { ddef = adef = NULL; dopt = NULL; - doff = state.singles = 0; + doff = state.singles = arglast = 0; if (ca_inactive(d, argxor, cur, 0) || ((d->flags & CDF_SEP) && !strcmp(line, "--"))) { @@ -1423,6 +1424,7 @@ ca_parse_line(Cadef d, int multi, int first) if ((d->flags & CDF_ARG) && ca_inactive(d, NULL, cur + 1, 1)) return 1; + arglast = 1; if (state.inopt) { state.inopt = 0; state.nargbeg = cur - 1; @@ -1434,7 +1436,11 @@ ca_parse_line(Cadef d, int multi, int first) (state.def->type == CAA_RREST || state.def->type == CAA_RARGS)) { state.inrest = 0; - state.opt = (cur == state.nargbeg + 1); + state.opt = (cur == state.nargbeg + 1 && + (!*line || + ((*line == '-' || *line == '+') && + (!line[1] || + (*line == '-' && line[1] == '-' && !line[2]))))); state.optbeg = state.nargbeg; state.argbeg = cur - 1; state.argend = argend; @@ -1510,6 +1516,10 @@ ca_parse_line(Cadef d, int multi, int first) } } else { ca_laststate.def = adef; + ca_laststate.opt = (!arglast || !*line || + ((*line == '-' || *line == '+') && + (!line[1] || + (*line == '-' && line[1] == '-' && !line[2])))); ca_laststate.ddef = NULL; ca_laststate.dopt = NULL; ca_laststate.optbeg = state.nargbeg; @@ -1801,7 +1811,7 @@ bin_comparguments(char *nam, char **args, char *ops, int func) for (; lstate; lstate = lstate->snext) { if (lstate->actopts && (lstate->opt || (lstate->doff && lstate->def) || - (lstate->def && + (lstate->def && lstate->def->opt && (lstate->def->type == CAA_OPT || (lstate->def->type >= CAA_RARGS && lstate->def->num < 0)))) && |