Provide implementations for iscntrl, ispunct and isgraph.

Sponsored by: Netflix
This commit is contained in:
imp 2017-12-08 19:57:02 +00:00
parent 6bb46c6f8f
commit fdba3fb09c

View File

@ -235,6 +235,22 @@ static __inline int isalnum(int c)
return isalpha(c) || isdigit(c);
}
static __inline int iscntrl(int c)
{
return (c >= 0 && c < ' ') || c == 127;
}
static __inline int isgraph(int c)
{
return c >= '!' && c <= '~';
}
static __inline int ispunct(int c)
{
return (c >= '!' && c <= '/') || (c >= ':' && c <= '@') ||
(c >= '[' && c <= '`') || (c >= '{' && c <= '~');
}
static __inline int toupper(int c)
{
return islower(c) ? c - 'a' + 'A' : c;