From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 833F8385B514; Wed, 15 Feb 2023 21:37:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 833F8385B514 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676497070; bh=N970pavnY34BoVILXinzTAiptAZjZasoZCcDw/eKsH4=; h=From:To:Subject:Date:From; b=YU6loHEIr7kPpZv/IgSgZdLn8RjgzhNjAF+34KsifqPTh5HpVQXtli9s+jP3GmYi6 jrWgcAraVsv2hZsC7q0QNOdeJugo0sPMUAKL9v2BXd0zqipHYhsnpP8yjl3npKiKY9 B0fFVhyPGvR015HUo1UTSAf6HlQ85VAhkOuG8ay8= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: fnmatch: handle equivalence class expressions X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: b5f9b0241a36b8e0197405fc5ab23cbf0ba43e03 X-Git-Newrev: 20162667de8c0029c974420230f2dcc903159e66 Message-Id: <20230215213750.833F8385B514@sourceware.org> Date: Wed, 15 Feb 2023 21:37:50 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D20162667de8= c0029c974420230f2dcc903159e66 commit 20162667de8c0029c974420230f2dcc903159e66 Author: Corinna Vinschen AuthorDate: Wed Feb 15 22:31:49 2023 +0100 Commit: Corinna Vinschen CommitDate: Wed Feb 15 22:31:49 2023 +0100 Cygwin: fnmatch: handle equivalence class expressions =20 Handle [=3Dx=3D] expressions in range brackets. Use the new is_unicode_equiv() function to perform the check. =20 Signed-off-by: Corinna Vinschen 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 flag= s, char **newp, ++pattern; if (!*pattern) return (RANGE_ERROR); - if (ctype =3D=3D ':') { + if (ctype =3D=3D ':') { /* named character class */ size_t clen =3D pattern - class_p; char class[clen + 1]; =20 *stpncpy (class, class_p, clen) =3D '\0'; if (iswctype (test, wctype (class))) ok =3D 1; + } else if (ctype =3D=3D '=3D') { /* equivalence class */ + size_t elen =3D pattern - class_p; + char equiv[elen + 1]; + wint_t eqv; + + *stpncpy (equiv, class_p, elen) =3D '\0'; + if (mbrtowi(&eqv, equiv, elen, patmbs) =3D=3D elen + && is_unicode_equiv (test, eqv)) + ok =3D 1; } + /* TODO: [. is just ignored for now */ pattern +=3D 2; - /* TODO: [. and [=3D are just ignored for now */ continue; =20 }