OSDN Git Service

bionic: Teach fnmatch(3) to handle UTF-8 characters in patterns
authorTom Marshall <tdm@cyngn.com>
Fri, 1 Apr 2016 21:57:21 +0000 (14:57 -0700)
committerSteve Kondik <steve@cyngn.com>
Sun, 4 Sep 2016 04:49:19 +0000 (21:49 -0700)
commit1b00fdd5be81be1e0b27515bf6f31d228d59c231
tree348939f3c7e67f6304ea2bc9bc116977cff6665d
parent6069ffc51b195aa7c09694fd2004614e9078b677
bionic: Teach fnmatch(3) to handle UTF-8 characters in patterns

This is NOT comprehensive UTF-8 support.  It is just a quick hack to
make alternation work in bracket expressions so that the system file
manager can find files with non-ASCII names in root mode.  Bracket
expressions that contain non-ASCII ranges are explicitly avoided to
avoid the complexities of unicode collation rules.

Things like the following will now work:

fnmatch("те[с][т].jpg", "тест.jpg", 0);
fnmatch("test[αβγ].txt", "testβ.txt", 0);

Things like the following will still fail:

fnmatch("тес[а-я].txt", "тест.txt", 0);

Jira: CYNGNOS-2336

Change-Id: If38dc6692bc22d20128b0cd8a7632754a496d7fb
libc/upstream-openbsd/lib/libc/gen/fnmatch.c