cleanup
[rpikern] / src / libc / ctype.c
1 #include "ctype.h"
2
3 int isalnum(int c)
4 {
5         return isalpha(c) || isdigit(c);
6 }
7
8 int isalpha(int c)
9 {
10         return isupper(c) || islower(c);
11 }
12
13 int isblank(int c)
14 {
15         return c == ' ' || c == '\t';
16 }
17
18 int isdigit(int c)
19 {
20         return c >= '0' && c <= '9';
21 }
22
23 int isupper(int c)
24 {
25         return c >= 'A' && c <= 'Z';
26 }
27
28 int islower(int c)
29 {
30         return c >= 'a' && c <= 'z';
31 }
32
33 int isgraph(int c)
34 {
35         return c > ' ' && c <= '~';
36 }
37
38 int isprint(int c)
39 {
40         return isgraph(c) || c == ' ';
41 }
42
43 int isspace(int c)
44 {
45         return isblank(c) || c == '\f' || c == '\n' || c == '\r' || c == '\v';
46 }
47
48 int toupper(int c)
49 {
50         return islower(c) ? (c + ('A' - 'a')) : c;
51 }
52
53 int tolower(int c)
54 {
55         return isupper(c) ? (c - ('A' - 'a')) : c;
56 }