Home | History | Annotate | Download | only in include
      1 #ifndef CTYPE_H
      2 #define CTYPE_H
      3 
      4 /*
      5  * Small subset of <ctype.h> for parsing uses, only handles ASCII
      6  * and passes the rest through.
      7  */
      8 
      9 static inline int toupper(int c)
     10 {
     11     if (c >= 'a' && c <= 'z')
     12 	c -= 0x20;
     13 
     14     return c;
     15 }
     16 
     17 static inline int tolower(int c)
     18 {
     19     if (c >= 'A' && c <= 'Z')
     20 	c += 0x20;
     21 
     22     return c;
     23 }
     24 
     25 static inline int isspace(int ch)
     26 {
     27     int space = 0;
     28     if ((ch == ' ') ||
     29 	(ch == '\f') ||
     30 	(ch == '\n') ||
     31 	(ch == '\r') ||
     32 	(ch == '\t') ||
     33 	(ch == '\v'))
     34 	space = 1;
     35     return space;
     36 }
     37 
     38 #endif /* CTYPE_H */
     39