mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-06-06 23:36:03 +02:00
47913: implement CASE_PATHS option to make NO_CASE_GLOB more sensible
This commit is contained in:
parent
1bec15a010
commit
408a830483
|
@ -1,3 +1,8 @@
|
||||||
|
2021-04-10 Bart Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
|
* 47913: Doc/Zsh/options.yo, Src/options.c, Src/pattern.c, Src/zsh.h:
|
||||||
|
implement CASE_PATHS option to make NO_CASE_GLOB more sensible
|
||||||
|
|
||||||
2021-04-10 dana <dana@dana.is>
|
2021-04-10 dana <dana@dana.is>
|
||||||
|
|
||||||
* unposted (see 48415): README: Document incompatibility
|
* unposted (see 48415): README: Document incompatibility
|
||||||
|
|
|
@ -474,6 +474,22 @@ item(tt(CASE_MATCH) <D>)(
|
||||||
Make regular expressions using the tt(zsh/regex) module (including
|
Make regular expressions using the tt(zsh/regex) module (including
|
||||||
matches with tt(=~)) sensitive to case.
|
matches with tt(=~)) sensitive to case.
|
||||||
)
|
)
|
||||||
|
pindex(CASE_PATHS)
|
||||||
|
pindex(NO_CASE_PATHS)
|
||||||
|
pindex(CASEPATHS)
|
||||||
|
pindex(NOCASEPATHS)
|
||||||
|
cindex(case-sensitive globbing, option)
|
||||||
|
item(tt(CASE_PATHS))(
|
||||||
|
If tt(CASE_PATHS) is not set (the default), tt(CASE_GLOB) affects the
|
||||||
|
interpretation of em(every) path component, whenever a special
|
||||||
|
character appears in em(any) component. When tt(CASE_PATHS) is set,
|
||||||
|
file path components that do em(not) contain special filename
|
||||||
|
generation characters are always sensitive to case, thus restricting
|
||||||
|
tt(NO_CASE_GLOB) to components that contain globbing characters.
|
||||||
|
|
||||||
|
Note that if the filesystem itself is not sensitive to case, then
|
||||||
|
tt(CASE_PATHS) has no effect.
|
||||||
|
)
|
||||||
pindex(CSH_NULL_GLOB)
|
pindex(CSH_NULL_GLOB)
|
||||||
pindex(NO_CSH_NULL_GLOB)
|
pindex(NO_CSH_NULL_GLOB)
|
||||||
pindex(CSHNULLGLOB)
|
pindex(CSHNULLGLOB)
|
||||||
|
|
|
@ -105,6 +105,7 @@ static struct optname optns[] = {
|
||||||
{{NULL, "bsdecho", OPT_EMULATE|OPT_SH}, BSDECHO},
|
{{NULL, "bsdecho", OPT_EMULATE|OPT_SH}, BSDECHO},
|
||||||
{{NULL, "caseglob", OPT_ALL}, CASEGLOB},
|
{{NULL, "caseglob", OPT_ALL}, CASEGLOB},
|
||||||
{{NULL, "casematch", OPT_ALL}, CASEMATCH},
|
{{NULL, "casematch", OPT_ALL}, CASEMATCH},
|
||||||
|
{{NULL, "casepaths", 0}, CASEPATHS},
|
||||||
{{NULL, "cbases", 0}, CBASES},
|
{{NULL, "cbases", 0}, CBASES},
|
||||||
{{NULL, "cprecedences", OPT_EMULATE|OPT_NONZSH}, CPRECEDENCES},
|
{{NULL, "cprecedences", OPT_EMULATE|OPT_NONZSH}, CPRECEDENCES},
|
||||||
{{NULL, "cdablevars", OPT_EMULATE}, CDABLEVARS},
|
{{NULL, "cdablevars", OPT_EMULATE}, CDABLEVARS},
|
||||||
|
|
|
@ -509,7 +509,7 @@ void
|
||||||
patcompstart(void)
|
patcompstart(void)
|
||||||
{
|
{
|
||||||
patcompcharsset();
|
patcompcharsset();
|
||||||
if (isset(CASEGLOB))
|
if (isset(CASEGLOB) || isset(CASEPATHS))
|
||||||
patglobflags = 0;
|
patglobflags = 0;
|
||||||
else
|
else
|
||||||
patglobflags = GF_IGNCASE;
|
patglobflags = GF_IGNCASE;
|
||||||
|
@ -632,6 +632,13 @@ patcompile(char *exp, int inflags, char **endexp)
|
||||||
p->patmlen = len;
|
p->patmlen = len;
|
||||||
p->patnpar = patnpar-1;
|
p->patnpar = patnpar-1;
|
||||||
|
|
||||||
|
#ifndef __CYGWIN__ /* The filesystem itself is case-insensitive on Cygwin */
|
||||||
|
if ((patflags & PAT_FILE) && !isset(CASEGLOB) && !(patflags & PAT_PURES)) {
|
||||||
|
p->globflags |= GF_IGNCASE;
|
||||||
|
p->globend |= GF_IGNCASE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!strp) {
|
if (!strp) {
|
||||||
pscan = (Upat)(patout + startoff);
|
pscan = (Upat)(patout + startoff);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue