about summary refs log tree commit diff
path: root/Src/Zle/computil.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-23 14:24:39 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-23 14:24:39 +0000
commit616d348e392e87d491abe5dab2068704aafb00e5 (patch)
tree0e91bd115f6f9895129a084aa8029b873fff8e98 /Src/Zle/computil.c
parent003d10889614f87e3fee6c1689a8abdaaf3efacb (diff)
downloadzsh-616d348e392e87d491abe5dab2068704aafb00e5.tar.gz
zsh-616d348e392e87d491abe5dab2068704aafb00e5.tar.xz
zsh-616d348e392e87d491abe5dab2068704aafb00e5.zip
zsh-workers/8749
Diffstat (limited to 'Src/Zle/computil.c')
-rw-r--r--Src/Zle/computil.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 15db89bdf..fd39e255b 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -941,13 +941,17 @@ ca_get_opt(Cadef d, char *line, int full, char **end)
 {
     Caopt p;
 
-    if (full) {
-	/* The full string has to be an option. */
+    /* The full string may be an option. */
 
-	for (p = d->opts; p; p = p->next)
-	    if (p->active && !strcmp(p->name, line))
-		return p;
-    } else {
+    for (p = d->opts; p; p = p->next)
+	if (p->active && !strcmp(p->name, line)) {
+	    if (end)
+		*end = line + strlen(line);
+
+	    return p;
+	}
+
+    if (!full) {
 	/* The string from the line probably only begins with an option. */
 	for (p = d->opts; p; p = p->next)
 	    if (p->active && ((!p->args || p->type == CAO_NEXT) ?
@@ -1160,7 +1164,7 @@ ca_parse_line(Cadef d)
 	    } LASTALLOC;
 	    ca_inactive(d, state.curopt->xor);
 
-	    /* Collect the argument strings. MAybe. */
+	    /* Collect the argument strings. Maybe. */
 
 	    if (state.def &&
 		(state.curopt->type == CAO_DIRECT ||
@@ -1431,7 +1435,7 @@ bin_comparguments(char *nam, char **args, char *ops, int func)
 	    return 1;
 	}
     case 'O':
-	if (ca_laststate.opt) {
+	if (ca_laststate.opt || (ca_laststate.doff && ca_laststate.def)) {
 	    LinkList next = newlinklist();
 	    LinkList direct = newlinklist();
 	    LinkList odirect = newlinklist();
@@ -1484,7 +1488,8 @@ bin_comparguments(char *nam, char **args, char *ops, int func)
 	    return 1;
 	}
     case 's':
-	if (ca_laststate.d->single && ca_laststate.singles) {
+	if (ca_laststate.d->single && ca_laststate.singles &&
+	    ca_laststate.opt) {
 	    setsparam(args[1],
 		      ztrdup(ca_laststate.ddef ?
 			     (ca_laststate.ddef->type == CAO_DIRECT ?