Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug: Ubuntu apt-get install package-*



[>workers]

On Nov 10, 10:43pm, Bob wrote:
}
} When I run install commands with `*` for all packages I get a zsh error
} while it works in bash.

Maybe it's time for something like this?

(Truly horrible implementation follows, don't commit this, presented
for example purposes only, etc. etc.)

torch% echo bl?or*
zsh: no matches found: bl?or*
torch% setopt correctall
torch% echo bl?or*      
zsh: correct 'bl?or*' to 'bl\?or\*' [nyae]? y
bl?or*


diff --git a/Src/utils.c b/Src/utils.c
index 3d535b8..b9cd227 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2948,6 +2948,31 @@ spckword(char **s, int hist, int cmd, int ask)
 	return;
     if (!(*s)[0] || !(*s)[1])
 	return;
+
+    if (!incond && !incmdpos && isset(NOMATCH) && haswilds(*s)) {
+	char *b, *g;
+	untokenize(g = dupstring(guess = *s));
+	b = quotestring(best = g, QT_BACKSLASH_PATTERN);
+	if (ask) {
+	    if (noquery(0)) {
+		x = 'n';
+	    } else if (shout) {
+		char *pptbuf;
+		pptbuf = promptexpand(sprompt, 0, b, g, NULL);
+		zputs(pptbuf, shout);
+		free(pptbuf);
+		fflush(shout);
+		zbeep();
+		x = getquery("nyae \t", 0);
+		if (cmd && x == 'n')
+		    pathchecked = path;
+	    } else
+		x = 'n';
+	} else
+	    x = 'y';
+	goto Interpret;
+    }
+
     if (cmd) {
 	if (shfunctab->getnode(shfunctab, *s) ||
 	    builtintab->getnode(builtintab, *s) ||
@@ -3087,6 +3112,7 @@ spckword(char **s, int hist, int cmd, int ask)
 		x = 'n';
 	} else
 	    x = 'y';
+    Interpret:
 	if (x == 'y' || x == ' ' || x == '\t') {
 	    *s = dupstring(best);
 	    if (hist)



Messages sorted by: Reverse Date, Date, Thread, Author