From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-workers@math.gatech.edu
Subject: PATCH: 3.1.5 - (Sven) Case-insensitive globbing
Date: Sat, 31 Oct 1998 02:14:16 -0800 [thread overview]
Message-ID: <981031021416.ZM12242@candle.brasslantern.com> (raw)
Sven's patch for case-insensitive globbing, applied to 3.1.5. This does NOT
include any of the enhanced compctl stuff that makes use of it.
Index: Doc/Zsh/expn.yo
===================================================================
diff -u -r1.1.1.2 -r1.8
--- expn.yo 1998/10/30 15:56:51 1.1.1.2
+++ expn.yo 1998/10/30 17:52:39 1.8
@@ -1010,6 +1011,14 @@
item(tt(D))(
sets the tt(GLOB_DOTS) option for the current pattern
pindex(GLOB_DOTS, setting in pattern)
+)
+item(tt(f))(
+makes lower case letters in the pattern match themselves and the
+corresponding uppercase letter
+)
+item(tt(F))(
+makes all letters match themselves and their uppercase or lowercase
+counterpart
)
enditem()
Index: Src/glob.c
===================================================================
diff -u -r1.1.1.2 -r1.4
--- glob.c 1998/10/30 15:57:02 1.1.1.2
+++ glob.c 1998/10/30 17:52:44 1.4
@@ -81,6 +81,7 @@
static int qualct, qualorct;
static int range, amc, units;
static int gf_nullglob, gf_markdirs, gf_noglobdots, gf_listtypes, gf_follow;
+static int gf_case = 0;
/* Prefix, suffix for doing zle trickery */
@@ -868,6 +869,7 @@
Complist q; /* pattern after parsing */
char *ostr = (char *)getdata(np); /* the pattern before the parser */
/* chops it up */
+ int gfc = 0; /* case insensitive? */
MUSTUSEHEAP("glob");
if (unset(GLOBOPT) || !haswilds(ostr)) {
@@ -1206,6 +1208,12 @@
++s;
data = qgetnum(&s);
break;
+ case 'f':
+ gfc = 1;
+ break;
+ case 'F':
+ gfc = 2;
+ break;
default:
zerr("unknown file attribute", NULL, 0);
@@ -1262,7 +1270,9 @@
/* The actual processing takes place here: matches go into *
* matchbuf. This is the only top-level call to scanner(). */
+ gf_case = gfc;
scanner(q);
+ gf_case = 0;
/* Deal with failures to match depending on options */
if (matchct)
@@ -2489,7 +2499,9 @@
}
continue;
}
- if (*pptr == *pat) {
+ if (*pptr == *pat ||
+ (gf_case == 1 ? (islower(*pat) && tuupper(*pat) == *pptr) :
+ (gf_case == 2 ? (tulower(*pat) == tulower(*pptr)) : 0))) {
/* just plain old characters */
pptr++;
pat++;
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
next reply other threads:[~1998-10-31 10:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-31 10:14 Bart Schaefer [this message]
1998-11-02 9:21 ` Zefram
1998-11-02 17:07 ` Peter Stephenson
1998-11-02 17:45 ` Bruce Stephens
1998-11-02 18:06 ` Zefram
1998-11-03 8:12 ` Sven Wischnowsky
1998-11-03 12:22 ` Bruce Stephens
1998-11-03 12:47 ` Bruce Stephens
1998-11-03 15:01 ` Zefram
1998-11-03 15:27 ` Bruce Stephens
[not found] ` <MLIST_vbn269dkyw.fsf@snake.isode.com>
1998-11-03 18:09 ` Jarkko Hietaniemi
1998-11-03 18:54 ` Zefram
1998-11-03 19:14 ` Jarkko Hietaniemi
1998-11-03 19:27 ` Zefram
1998-11-03 19:36 ` Jarkko Hietaniemi
1998-11-04 18:48 ` Bart Schaefer
1998-11-05 9:26 ` PATCH: 3.1.5: Case-insensitive globbing (2) Peter Stephenson
1998-11-05 18:15 ` Bart Schaefer
1998-11-06 11:01 ` PATCH: 3.1.5: doc fix, was re: Case-insensitive globbing Peter Stephenson
1998-11-06 13:43 ` Bruce Stephens
1998-11-06 9:24 ` Approximate matching Bart Schaefer
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=981031021416.ZM12242@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@math.gatech.edu \
/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).