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

Re: PATCH: case-insensitive globbing

Peter Stephenson wrote:
> There's one patch I need to get in to improve efficiency on Cygwin
> (currently the shell will try to search the entire directory for files
> since it doesn't know the OS treats all files case insensitively)
> which I'll try and do later.

This is it.  Seems to work OK, but could do with some playing around
with by a Cygwin hacker.

Oliver wrote:
> It's just a thought but would it be somehow possible to detect the
> filesystem type and allow the efficency gain to be of use where, for
> example, a windows partition is mounted from linux.

Yes, it occurred to me, but it's too complicated for now.  Also, it
means checking for every single file when the option is on.  I'm not
sure this can be done efficiently.

Index: Src/pattern.c
RCS file: /cvsroot/zsh/zsh/Src/pattern.c,v
retrieving revision 1.17
diff -u -r1.17 pattern.c
--- Src/pattern.c	6 Mar 2004 00:23:03 -0000	1.17
+++ Src/pattern.c	8 Mar 2004 11:49:37 -0000
@@ -344,7 +344,16 @@
     if (!(patflags & PAT_ANY)) {
 	/* Look for a really pure string, with no tokens at all. */
-	if (!patglobflags)
+	if (!patglobflags
+#ifdef __CYGWIN__
+	    /*
+	     * If the OS treats files case-insensitively and we
+	     * are looking at files, we don't need to use pattern
+	     * matching to find the file.
+	     */
+	    || (!(patglobflags & ~GF_IGNCASE) && (patflags & PAT_FILE))
+	    )
 	    for (strp = exp; *strp &&
 		     (!(patflags & PAT_FILE) || *strp != '/') && !itok(*strp);

Peter Stephenson <pws@xxxxxxx>                  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.


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