From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10076 invoked from network); 6 Mar 2004 00:17:50 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 6 Mar 2004 00:17:50 -0000 Received: (qmail 13371 invoked by alias); 6 Mar 2004 00:17:32 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7121 Received: (qmail 13333 invoked from network); 6 Mar 2004 00:17:31 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 6 Mar 2004 00:17:31 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [195.92.195.176] by sunsite.dk (MessageWall 1.0.8) with SMTP; 6 Mar 2004 0:17:31 -0000 Received: from modem-226.fire-goby.dialup.pol.co.uk ([62.137.11.226] helo=pwstephenson.fsnet.co.uk) by cmailg6.svr.pol.co.uk with esmtp (Exim 4.14) id 1AzPVR-00074d-Pw for zsh-users@sunsite.dk; Sat, 06 Mar 2004 00:17:30 +0000 Received: by pwstephenson.fsnet.co.uk (Postfix, from userid 501) id 0B5CF8551; Fri, 5 Mar 2004 19:18:31 -0500 (EST) Received: from pwstephenson.fsnet.co.uk (localhost [127.0.0.1]) by pwstephenson.fsnet.co.uk (Postfix) with ESMTP id D6AA98543 for ; Sat, 6 Mar 2004 00:18:31 +0000 (GMT) To: zsh-users@sunsite.dk Subject: PATCH: case-insensitive globbing In-reply-to: "Michael Schaap"'s message of "Fri, 05 Mar 2004 14:05:57 +0100." <40487B35.2080802@mscha.com> Date: Sat, 06 Mar 2004 00:18:30 +0000 From: Peter Stephenson Message-Id: <20040306001831.0B5CF8551@pwstephenson.fsnet.co.uk> Michael Schaap wrote: > It would be nice, though, if zsh had an option to make file globbing > case insensitive. I'd enable than on my Cygwin machine, since the > Windows file systems basically *are* case insensitive... > > (Bash has such an option: nocaseglob...) This has been on the wish list for ages, but I just realised it's completely trivial to implement... so trivial it might as well be in 4.2.0. It's just the existing code for (#i) turn on at the start of all file globs. (Follow-ups to zsh-workers, please, I just thought I'd advertise it...) `setopt nocaseglob' (or `unsetopt caseglob') to activate. Index: Doc/Zsh/options.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v retrieving revision 1.29 diff -u -r1.29 options.yo --- Doc/Zsh/options.yo 10 Feb 2004 19:19:02 -0000 1.29 +++ Doc/Zsh/options.yo 6 Mar 2004 00:04:29 -0000 @@ -219,6 +219,16 @@ This disables backslashed escape sequences in echo strings unless the tt(-e) option is specified. ) +pindex(CASE_GLOB) +cindex(case-insensitive globbing, option) +item(tt(CASE_GLOB) )( +Make globbing (filename generation) sensitive to case. Note that other +uses of patterns are always sensitive to case. If the option is unset, +the presence of any character which is special to filename generation +will cause case-insensitive matching. For example, tt(cvs(/)) can +match the directory tt(CVS) owing to the presence of the globbing flag +(unless the option tt(BARE_GLOB_QUAL) is unset). +) pindex(C_BASES) cindex(bases, output in C format) cindex(hexadecimal, output in C format) Index: Src/options.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/options.c,v retrieving revision 1.16 diff -u -r1.16 options.c --- Src/options.c 15 May 2003 09:39:57 -0000 1.16 +++ Src/options.c 6 Mar 2004 00:04:38 -0000 @@ -92,6 +92,7 @@ {NULL, "bgnice", OPT_EMULATE|OPT_NONBOURNE, BGNICE}, {NULL, "braceccl", OPT_EMULATE, BRACECCL}, {NULL, "bsdecho", OPT_EMULATE|OPT_SH, BSDECHO}, +{NULL, "caseglob", OPT_ALL, CASEGLOB}, {NULL, "cbases", 0, CBASES}, {NULL, "cdablevars", OPT_EMULATE, CDABLEVARS}, {NULL, "chasedots", OPT_EMULATE, CHASEDOTS}, Index: Src/pattern.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/pattern.c,v retrieving revision 1.16 diff -u -r1.16 pattern.c --- Src/pattern.c 3 Dec 2003 10:54:36 -0000 1.16 +++ Src/pattern.c 6 Mar 2004 00:04:46 -0000 @@ -289,7 +289,10 @@ void patcompstart(void) { - patglobflags = 0; + if (isset(CASEGLOB)) + patglobflags = 0; + else + patglobflags = GF_IGNCASE; } /* Top level pattern compilation subroutine */ Index: Src/zsh.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v retrieving revision 1.52 diff -u -r1.52 zsh.h --- Src/zsh.h 15 Dec 2003 22:45:29 -0000 1.52 +++ Src/zsh.h 6 Mar 2004 00:04:53 -0000 @@ -1412,6 +1412,7 @@ BGNICE, BRACECCL, BSDECHO, + CASEGLOB, CBASES, CDABLEVARS, CHASEDOTS, -- Peter Stephenson Work: pws@csr.com Web: http://www.pwstephenson.fsnet.co.uk