| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /* Minimal freestanding ctype.h for ring-3 commands. */
- #ifndef LIBC_CTYPE_H
- #define LIBC_CTYPE_H
- static inline int isdigit(int c)
- {
- return c >= '0' && c <= '9';
- }
- static inline int isxdigit(int c)
- {
- return (c >= '0' && c <= '9') ||
- (c >= 'a' && c <= 'f') ||
- (c >= 'A' && c <= 'F');
- }
- static inline int isupper(int c)
- {
- return c >= 'A' && c <= 'Z';
- }
- static inline int islower(int c)
- {
- return c >= 'a' && c <= 'z';
- }
- static inline int isalpha(int c)
- {
- return isupper(c) || islower(c);
- }
- static inline int isalnum(int c)
- {
- return isalpha(c) || isdigit(c);
- }
- static inline int isspace(int c)
- {
- return c == ' ' || c == '\t' || c == '\n' ||
- c == '\v' || c == '\f' || c == '\r';
- }
- static inline int toupper(int c)
- {
- return (c >= 'a' && c <= 'z') ? c - 'a' + 'A' : c;
- }
- static inline int tolower(int c)
- {
- return (c >= 'A' && c <= 'Z') ? c - 'A' + 'a' : c;
- }
- #endif
|