From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4362 invoked from network); 14 May 2004 10:56:26 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 14 May 2004 10:56:26 -0000 Received: (qmail 2124 invoked from network); 14 May 2004 10:55:31 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 May 2004 10:55:31 -0000 Received: (qmail 23468 invoked by alias); 14 May 2004 10:55:20 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7454 Received: (qmail 23454 invoked from network); 14 May 2004 10:55:20 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 14 May 2004 10:55:17 -0000 Received: (qmail 1388 invoked from network); 14 May 2004 10:55:17 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 14 May 2004 10:55:15 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i4EAsmv12153 for ; Fri, 14 May 2004 10:54:48 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Fri, 14 May 2004 11:54:17 +0100 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 14 May 2004 11:56:31 +0100 To: zsh-users@sunsite.dk Subject: Re: Recursive globbing In-reply-to: "Vincent Lefevre"'s message of "Fri, 14 May 2004 12:25:11 +0200." <20040514102510.GF10581@greux.loria.fr> Date: Fri, 14 May 2004 11:54:48 +0100 Message-ID: <232.1084532088@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 14 May 2004 10:56:31.0208 (UTC) FILETIME=[1D49D680:01C439A2] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: * X-Spam-Status: No, hits=1.6 required=6.0 tests=BAYES_60 autolearn=no version=2.63 X-Spam-Hits: 1.6 Vincent Lefevre wrote: > Hi, > > Is there any difference between *.tex and **.tex ? No, and in fact they are documented to be the same. Hence... > If there's none, > how about having improved recursive globbing, where ** not followed > by a slash would mean **/* (ditto for *** -> ***/*)? I can't see any problem with this, unless people are habitually using double stars in the place of single stars, for example to avoid having to prune patterns. I doubt it, but are they? Index: Src/glob.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/glob.c,v retrieving revision 1.33 diff -u -r1.33 glob.c --- Src/glob.c 6 Apr 2004 17:45:47 -0000 1.33 +++ Src/glob.c 14 May 2004 10:50:20 -0000 @@ -639,14 +639,21 @@ char *str; int compflags = gf_noglobdots ? (PAT_FILE|PAT_NOGLD) : PAT_FILE; - if (instr[0] == Star && instr[1] == Star && - (instr[2] == '/' || (instr[2] == Star && instr[3] == '/'))) { + if (instr[0] == Star && instr[1] == Star) { /* Match any number of directories. */ int follow; /* with three stars, follow symbolic links */ follow = (instr[2] == Star); - instr += (3 + follow); + if (instr[2] == '/' || (instr[2] == Star && instr[3] == '/')) { + instr += (3 + follow); + } else { + /* + * Make **(|[^/\*]*) or ***(|[^/]) equivalent to + * **[/]*(...) or ***[/]*(...), respectively. + */ + instr += 1 + follow; + } /* Now get the next path component if there is one. */ l1 = (Complist) zhalloc(sizeof *l1); Index: Doc/Zsh/expn.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/expn.yo,v retrieving revision 1.49 diff -u -r1.49 expn.yo --- Doc/Zsh/expn.yo 6 Apr 2004 09:26:50 -0000 1.49 +++ Doc/Zsh/expn.yo 14 May 2004 10:50:21 -0000 @@ -1590,9 +1590,12 @@ does a recursive directory search for files named `tt(bar)' (potentially including the file `tt(bar)' in the current directory). This form does not follow symbolic links; the alternative form `tt(***/)' does, but is -otherwise identical. Neither of these can be combined with other forms of -globbing within the same path segment; in that case, the `tt(*)' -operators revert to their usual effect. +otherwise identical. + +As a further shorthand, `tt(**)' or `tt(***)' followed by anything other +than a `tt(/)' are treated the same way as `tt(**/*)' and `tt(***/*)', +respectively. Hence `tt(**.c)' is equivalent to `tt(**/*.c)' and so to +`tt((*/)#*.c)'. subsect(Glob Qualifiers) cindex(globbing, qualifiers) cindex(qualifiers, globbing) -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************