summaryrefslogtreecommitdiff
path: root/lib/libc/wctype/wctype.c
blob: 0495ba8c002b111295c4cc7cdfc82e8c426248d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
}