summaryrefslogtreecommitdiff
path: root/lib/libc/wctype/wctype.c
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
commitfc00c656c96528112d05cf0edf8631bd5eaea446 (patch)
treea6e0e6c588191a8bd1c64afc3b7a258e3e66c236 /lib/libc/wctype/wctype.c
Add build system scaffolding and libc headers
Diffstat (limited to 'lib/libc/wctype/wctype.c')
-rw-r--r--lib/libc/wctype/wctype.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/libc/wctype/wctype.c b/lib/libc/wctype/wctype.c
new file mode 100644
index 00000000..0495ba8c
--- /dev/null
+++ b/lib/libc/wctype/wctype.c
@@ -0,0 +1,32 @@
+#include <libc.h>
+#include <wctype.h>
+#include <string.h>
+
+wctype_t wctype(const char *property)
+{
+ int i;
+ const char *ptr;
+ static const char n[] = "alnum\0"
+ "alpha\0"
+ "blank\0"
+ "cntrl\0"
+ "digit\0"
+ "graph\0"
+ "lower\0"
+ "print\0"
+ "punct\0"
+ "space\0"
+ "upper\0"
+ "xdigit";
+
+ for (i = 1, ptr = n; *ptr; i++, ptr += strlen(ptr) + 1)
+ if (!strcmp(property, ptr))
+ return i;
+
+ return 0;
+}
+
+weak wctype_t wctype_l(const char *property, locale_t unused locale)
+{
+ return wctype(property);
+}