xref: /freebsd/lib/libc/locale/runetype.c (revision 2f04ec53)
1 #include <stdio.h>
2 #include <rune.h>
3 
4 unsigned long
5 ___runetype(c)
6 	_BSD_RUNE_T_ c;
7 {
8 	int x;
9 	_RuneRange *rr = &_CurrentRuneLocale->runetype_ext;
10 	_RuneEntry *re = rr->ranges;
11 
12 	if (c == EOF)
13 		return(0);
14 	for (x = 0; x < rr->nranges; ++x, ++re) {
15 		if (c < re->min)
16 			return(0L);
17 		if (c <= re->max) {
18 			if (re->types)
19 			    return(re->types[c - re->min]);
20 			else
21 			    return(re->map);
22 		}
23 	}
24 	return(0L);
25 }
26 
27