public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: fnmatch: handle equivalence class expressions Date: Wed, 15 Feb 2023 21:37:50 +0000 (GMT) [thread overview] Message-ID: <20230215213750.833F8385B514@sourceware.org> (raw) 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; }
reply other threads:[~2023-02-15 21:37 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230215213750.833F8385B514@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).