zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: case-insensitive globbing
Date: Mon, 08 Mar 2004 12:03:36 +0000	[thread overview]
Message-ID: <10956.1078747416@csr.com> (raw)
In-Reply-To: "Peter Stephenson"'s message of "Mon, 08 Mar 2004 10:33:49 GMT." <18393.1078742029@csr.com>

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))
+#endif
+	    )
 	    for (strp = exp; *strp &&
 		     (!(patflags & PAT_FILE) || *strp != '/') && !itok(*strp);
 		 strp++)

-- 
Peter Stephenson <pws@csr.com>                  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
**********************************************************************


       reply	other threads:[~2004-03-08 12:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <18393.1078742029@csr.com>
2004-03-08 12:03 ` Peter Stephenson [this message]
2004-03-08 13:38   ` Oliver Kiddle
2004-03-08 13:45     ` Peter Stephenson
     [not found] <20040308122200.GA13641@mail.guild.uwa.edu.au>
2004-03-08 12:34 ` Peter Stephenson
2004-03-08 12:40   ` James Devenish
2004-03-08 13:43     ` Peter Stephenson
2004-03-08 13:49     ` James Devenish
2004-03-08 16:36       ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10956.1078747416@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).