public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: fnmatch: handle equivalence class expressions
@ 2023-02-15 21:37 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-02-15 21:37 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=20162667de8c0029c974420230f2dcc903159e66
commit 20162667de8c0029c974420230f2dcc903159e66
Author: Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Wed Feb 15 22:31:49 2023 +0100
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Wed Feb 15 22:31:49 2023 +0100
Cygwin: fnmatch: handle equivalence class expressions
Handle [=x=] expressions in range brackets. Use the new
is_unicode_equiv() function to perform the check.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/libc/fnmatch.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/libc/fnmatch.c b/winsup/cygwin/libc/fnmatch.c
index 9829904f0812..40c1f2d59859 100644
--- a/winsup/cygwin/libc/fnmatch.c
+++ b/winsup/cygwin/libc/fnmatch.c
@@ -284,16 +284,25 @@ rangematch(const char *pattern, wint_t test, int flags, char **newp,
++pattern;
if (!*pattern)
return (RANGE_ERROR);
- if (ctype == ':') {
+ if (ctype == ':') { /* named character class */
size_t clen = pattern - class_p;
char class[clen + 1];
*stpncpy (class, class_p, clen) = '\0';
if (iswctype (test, wctype (class)))
ok = 1;
+ } else if (ctype == '=') { /* equivalence class */
+ size_t elen = pattern - class_p;
+ char equiv[elen + 1];
+ wint_t eqv;
+
+ *stpncpy (equiv, class_p, elen) = '\0';
+ if (mbrtowi(&eqv, equiv, elen, patmbs) == elen
+ && is_unicode_equiv (test, eqv))
+ ok = 1;
}
+ /* TODO: [. is just ignored for now */
pattern += 2;
- /* TODO: [. and [= are just ignored for now */
continue;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-15 21:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 21:37 [newlib-cygwin/main] Cygwin: fnmatch: handle equivalence class expressions Corinna Vinschen
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 read-only IMAP folder(s) and NNTP newsgroup(s).