summaryrefslogtreecommitdiffstats
path: root/libc/unistd/charclass.h
diff options
context:
space:
mode:
Diffstat (limited to 'libc/unistd/charclass.h')
-rw-r--r--libc/unistd/charclass.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/libc/unistd/charclass.h b/libc/unistd/charclass.h
new file mode 100644
index 0000000..5edb2c1
--- /dev/null
+++ b/libc/unistd/charclass.h
@@ -0,0 +1,29 @@
+/*
+ * Public domain, 2008, Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * $OpenBSD: charclass.h,v 1.1 2008/10/01 23:04:13 millert Exp $
+ */
+
+/*
+ * POSIX character class support for fnmatch() and glob().
+ */
+static 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)