Skip to content

Commit

Permalink
Update OpenBSD glob implementation for Windows (#16948)
Browse files Browse the repository at this point in the history
We're considering making this used as a glob implementation on POSIX as
well, but first, we should rebase it from the latest version of OpenBSD.

This also adds a new internal header (charclass.h) for glob.

See conversation in GH-15564.

Co-authored-by: Christoph M. Becker <[email protected]>
  • Loading branch information
NattyNarwhal and cmb69 authored Jan 10, 2025
1 parent d8d1cb4 commit 97a26ae
Show file tree
Hide file tree
Showing 3 changed files with 426 additions and 144 deletions.
29 changes: 29 additions & 0 deletions win32/charclass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Public domain, 2008, Todd C. Miller <[email protected]>
*
* $OpenBSD: charclass.h,v 1.3 2020/10/13 04:42:28 guenther Exp $
*/

/*
* POSIX character class support for fnmatch() and glob().
*/
static const struct cclass {
const char *name;
int (*isctype)(int);
} cclasses[] = {
{ "alnum", isalnum },
{ "alpha", isalpha },
{ "blank", isblank },
{ "cntrl", iscntrl },
{ "digit", isdigit },
{ "graph", isgraph },
{ "lower", islower },
{ "print", isprint },
{ "punct", ispunct },
{ "space", isspace },
{ "upper", isupper },
{ "xdigit", isxdigit },
{ NULL, NULL }
};

#define NCCLASSES (sizeof(cclasses) / sizeof(cclasses[0]) - 1)
Loading

0 comments on commit 97a26ae

Please sign in to comment.