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

Re: PATCH: Re: _man only uses $manpath



Oliver Kiddle wrote:
> As an aside, can the filename generation below be put all in one word:
> it seems that I can't nest brackets with | and can't do things like (|/)
> without getting a zsh: bad pattern error.

> +   manpath=( /usr/man(-/N)
/(opt|usr)/(dt|share|X11R6|local)/(cat|)man(-/N) )

If you read the manual, you'll see that / in () isn't supposed to work,
with one exception which you can use here --- it's not exactly what you
want, because it will match those names to any depth:

/(opt|usr)/(dt|share|X11R6|local/)#(cat|)man(-/N)

There are actually two problems here.  The first is that the test for the
existence of a file segment in a closure is bungled.  The patch below
is supposed to fix this.  I can't see how the code as it is can be right.
(This wouldn't show up in this case, actually; only in the rare case where
you have a fixed string in (.../)#, as I did when testing the following,
which is presumably why no-one has ever noticed.)

The second is more subtle.  (.../)# behaves like **/, not ***/, in that it
won't follow links, so if /usr/local is a link (as it is here, which is why
I'm writing this at all) it won't be included.  That's deliberate, since
**/, and not ***/, is the abbreviation for (*/)#.  But it's rather
inconvenient.  I can't think of a really clean fix.

--- Src/glob.c.sfp	Tue Sep 14 13:43:43 1999
+++ Src/glob.c	Fri Sep 17 16:33:47 1999
@@ -476,7 +476,7 @@
 
 	    if (!errflag && !(q->closure && !strcmp(str, "."))) {
 		addpath(str);
-		if (!closure || statfullpath("", NULL, 1))
+		if (!closure || !statfullpath("", NULL, 1))
 		    scanner((q->closure) ? q : q->next);
 		pathbuf[pathpos = oppos] = '\0';
 	    }

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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