djones@megatest.UUCP (Dave Jones) (03/25/88)
// Here's a ctype.h for SunOS-3. It will probably work on most BSD // derived systems. Just compare it to the C version to verify. // No big deal, but it will save you some typing. #ifndef CTYPEH #define CTYPEH const int _U = 01; const int _L = 02; const int _N = 04; const int _S = 010; const int _P = 020; const int _C = 040; const int _X = 0100; const int _B = 0200; extern char _ctype_[]; inline int isalpha(char c) { return ((_ctype_+1)[c]&(_U|_L)); } inline int isupper(char c) { return ((_ctype_+1)[c]&_U); } inline int islower(char c) { return ((_ctype_+1)[c]&_L); } inline int isdigit(char c) { return ((_ctype_+1)[c]&_N); } inline int isxdigit(char c) { return ((_ctype_+1)[c]&_X); } inline int isspace(char c) { return ((_ctype_+1)[c]&_S); } inline int ispunct(char c) { return ((_ctype_+1)[c]&_P); } inline int isalnum(char c) { return ((_ctype_+1)[c]&(_U|_L|_N)); } inline int isprint(char c) { return ((_ctype_+1)[c]&(_P|_U|_L|_N|_B)); } inline int isgraph(char c) { return ((_ctype_+1)[c]&(_P|_U|_L|_N)); } inline int iscntrl(char c) { return ((_ctype_+1)[c]&_C); } inline int isascii(char c) { return ((unsigned)(c)<=0177); } inline int toupper(char c) { return ((c)-'a'+'A'); } inline int tolower(char c) { return ((c)-'A'+'a'); } inline int toascii(char c) { return ((c)&0177); } #endif CTYPEH