cynix

x86 UNIX-like OS
git clone git://git.2f30.org/cynix
Log | Files | Refs | README | LICENSE

ctype.h (809B)


      1 #ifndef __CTYPE_H__
      2 #define __CTYPE_H__
      3 
      4 static inline int
      5 isupper(int c)
      6 {
      7 	return (c >= 'A' && c <= 'Z');
      8 }
      9 
     10 static inline int
     11 islower(int c)
     12 {
     13 	return (c >= 'a' && c <= 'z');
     14 }
     15 
     16 static inline int
     17 isalpha(int c)
     18 {
     19 	return (isupper(c) || islower(c));
     20 }
     21 
     22 static inline int
     23 isdigit(int c)
     24 {
     25 	return (c >= '0' && c <= '9');
     26 }
     27 
     28 static inline int
     29 isxdigit(int c)
     30 {
     31 	return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
     32 }
     33 
     34 static inline int
     35 isspace(int c)
     36 {
     37 	return (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v');
     38 }
     39 
     40 static inline int
     41 isblank(int c)
     42 {
     43 	return (c == ' ' || c == '\t');
     44 }
     45 
     46 static inline int
     47 isalnum(int c)
     48 {
     49 	return (isalpha(c) || isdigit(c));
     50 }
     51 
     52 static inline int
     53 isprint(int c)
     54 {
     55 	return ((c > 32 && c < 127) || isspace(c));
     56 }
     57 
     58 #endif
     59