Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
wctype.c
Go to the documentation of this file.
1 #include <string.h>
2 #include <wctype.h>
3 
4 wctype_t wctype(const char* s)
5 {
6  wctype_t i;
7  const char* p;
8  /* order must match! */
9  static const char names[] = "alnum\0"
10  "alpha\0"
11  "blank\0"
12  "cntrl\0"
13  "digit\0"
14  "graph\0"
15  "lower\0"
16  "print\0"
17  "punct\0"
18  "space\0"
19  "upper\0"
20  "xdigit";
21  for(i = 1, p = names; *p; i++, p += 6)
22  {
23  if(*s == *p && !strcmp(s, p))
24  {
25  return i;
26  }
27  }
28  return 0;
29 }
wctype_t wctype(const char *s)
Definition: wctype.c:4
int strcmp(const char *s1, const char *s2)
Compares two null-terminated byte strings lexicographically.
Definition: strcmp.c:12
unsigned long wctype_t
Definition: wctype.h:12