d5a5e97ae601d8f0009813e9357cd4f30a2a407b
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / ctype.c
1 /*
2  * Acess2 C Library
3  * - By John Hodge (thePowersGang)
4  *
5  * ctype.c
6  * - Character Types
7  */
8 #include <ctype.h>
9
10 int isalpha(int ch)
11 {
12         if('A'<=ch&&ch<='Z')    return 1;
13         if('a'<=ch&&ch<='z')    return 1;
14         return 0;
15 }
16 int isdigit(int ch) {
17         if('0'<=ch&&ch<='9')    return 1;
18         return 0;
19 }
20
21 int isalnum(int ch) {
22         return isalpha(ch) || isdigit(ch);
23 }
24
25 int toupper(int ch) {
26         if('a'<=ch && ch <='z')
27                 return ch - 'a' + 'A';
28         return ch;
29 }
30 int tolower(int ch) {
31         if('A'<=ch && ch <='Z')
32                 return ch - 'A' + 'a';
33         return ch;
34 }
35
36 int isprint(int ch ) {
37         if( ch < ' ' )  return 0;
38         if( ch > 'z' )  return 0;
39         return 1;
40 }
41
42 int isspace(int ch) {
43         if(ch == ' ')   return 1;
44         if(ch == '\t')  return 1;
45         if(ch == '\r')  return 1;
46         if(ch == '\n')  return 1;
47         return 0;
48 }
49
50 int isxdigit(int ch) {
51         if('0'<=ch&&ch<='9')    return 1;
52         if('a'<=ch&&ch<='f')    return 1;
53         if('F'<=ch&&ch<='F')    return 1;
54         return 0;
55 }
56
57 // C99
58 int isblank(int ch) {
59         if(ch == ' ')   return 1;
60         if(ch == '\t')  return 1;
61         return 0;
62 }
63

UCC git Repository :: git.ucc.asn.au