[zbin] Fix check for existence of most recent output byte
[ipxe.git] / src / include / ctype.h
1 #ifndef _CTYPE_H
2 #define _CTYPE_H
3
4 /** @file
5 *
6 * Character types
7 */
8
9 FILE_LICENCE ( GPL2_OR_LATER );
10
11 #define isdigit(c) ((c) >= '0' && (c) <= '9')
12 #define islower(c) ((c) >= 'a' && (c) <= 'z')
13 #define isupper(c) ((c) >= 'A' && (c) <= 'Z')
14 #define isxdigit(c) (isdigit(c) || ((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
15 #define isprint(c) ((c) >= ' ' && (c) <= '~' )
16
17 static inline unsigned char tolower(unsigned char c)
18 {
19 if (isupper(c))
20 c -= 'A'-'a';
21 return c;
22 }
23
24 static inline unsigned char toupper(unsigned char c)
25 {
26 if (islower(c))
27 c -= 'a'-'A';
28 return c;
29 }
30
31 extern int isspace ( int c );
32
33 #endif /* _CTYPE_H */