source: trunk/sys/dietlibc/wctype.c @ 1

Last change on this file since 1 was 1, checked in by alain, 5 years ago

First import

File size: 583 bytes
Line 
1#include <wctype.h>
2#include <string.h>
3
4struct { const char* name; wctype_t func; } types[]={
5  { "alnum", iswalnum },
6  { "alpha", iswalpha },
7  { "blank", iswblank },
8  { "cntrl", iswcntrl },
9  { "digit", iswdigit },
10  { "graph", iswgraph },
11  { "lower", iswlower },
12  { "print", iswprint },
13  { "punct", iswpunct },
14  { "space", iswspace },
15  { "upper", iswupper },
16  { "xdigit", iswxdigit },
17};
18
19wctype_t wctype(const char* name) {
20  size_t i;
21  for (i=0; i<sizeof(types)/sizeof(types[0]); ++i)
22    if (!strcmp(name,types[i].name)) return types[i].func;
23  return (wctype_t)0;
24}
Note: See TracBrowser for help on using the repository browser.