aboutsummaryrefslogtreecommitdiff
path: root/win32/fnmatch.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* win32: bug fix in fnmatch(3)Ron Yorston2022-06-231-2/+5
| | | | | | | | | | | | | | | | | | | | | A user reports: Here is the shell script that causes me problems: var=foo:bar echo ${var#*[[:space:]]} What expect I to see echoed is foo:bar, however what I see bar. It seems that the [[:space:]] character class is matching the colon character in addition to whitespace characters. I see the same problem with the [[:blank:]] character class. This is due to a bug in the WIN32 implementation of fnmatch(3) which is derived from an old snapshot of glibc code (glibc commit 7814856974 from 1999-09-12). The bug was fixed in glibc by commit 83b1b6d8fa of 2000-07-04. Apply the equivalent fix to our version.
* win32: code shrink character class detectionRon Yorston2021-08-091-18/+14
| | | | | | | Add a routine to detect the names of character classes. Use it in fnmatch(3) and regcomp(3), replacing local code in the former. Saves 216 bytes.
* win32: fix fnmatch(3) handling of xdigitRon Yorston2021-08-091-1/+1
| | | | | | | | | | | | | | | | The glob pattern '[[:xdigit::]]*' didn't return the matches expected. It turns out the implementation (from glibc) fails to detect 'xdigit' as a valid character class. Changing the definition of CHAR_CLASS_MAX_LENGTH to 7 fixes the problem. This was never an issue in glibc because it uses a different definition. More modern versions of fnmatch(3) in glibc and gnulib also make CHAR_CLASS_MAX_LENGTH long enough. The code for fnmatch(3) was taken from glibc at commit 7814856974388a856a575fa45f88d502c8a1ab29. This was the last version before the code was rearraged to better support multibyte characters.
* win32: save bytes in fnmatchRon Yorston2020-02-161-13/+55
| | | | | | | Replace several explicit string comparisons with a single call to index_in_strings(). Saves 304 bytes.
* win32: use strchrnul from BusyBox in fnmatchRon Yorston2018-03-051-1/+5
| | | | | | BusyBox ensures that strchrnul is always available, either from the target platform or by including its own version. Therefore it isn't necessary for fnmatch to use its equivalent.
* win32/fnmatch: fix old-style function declarationJohannes Schindelin2017-08-231-1/+1
| | | | | | | | | | | | It would be more straight-forward to simply #include "libbb.h" which includes a #define getenv mingw_getenv, but that header also defines isprint() to a function that is nowhere to be found, leading to link problems. So let's go the easy route. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ron Yorston <rmy@pobox.com>
* win32/fnmatch: avoid old-style function definitionsJohannes Schindelin2017-08-231-12/+4
| | | | | Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ron Yorston <rmy@pobox.com>
* win32: Import fnmatch sourceNguyễn Thái Ngọc Duy2010-09-101-0/+488
This was extracted from commit e56b799d6ad8afba4168fffa7218d44c041a72d2 in Git repository.