From: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
To: zsh-users@sunsite.dk
Subject: PATCH: case-insensitive globbing
Date: Sat, 06 Mar 2004 00:18:30 +0000 [thread overview]
Message-ID: <20040306001831.0B5CF8551@pwstephenson.fsnet.co.uk> (raw)
In-Reply-To: "Michael Schaap"'s message of "Fri, 05 Mar 2004 14:05:57 +0100." <40487B35.2080802@mscha.com>
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) <D>)(
+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 <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk
next prev parent reply other threads:[~2004-03-06 0:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-04 14:11 make "for x in *$1*" case insensitive? zzapper
2004-03-04 14:20 ` Peter Stephenson
2004-03-04 16:08 ` zzapper
2004-03-04 16:46 ` Peter Stephenson
2004-03-04 18:26 ` zzapper
2004-03-05 13:05 ` Michael Schaap
2004-03-06 0:18 ` Peter Stephenson [this message]
2004-03-06 6:15 ` PATCH: case-insensitive globbing Bart Schaefer
2004-03-08 10:33 ` Peter Stephenson
2004-03-08 11:15 ` Oliver Kiddle
2004-03-08 12:22 ` James Devenish
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=20040306001831.0B5CF8551@pwstephenson.fsnet.co.uk \
--to=pws@pwstephenson.fsnet.co.uk \
--cc=zsh-users@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).