Provide implementations for iscntrl, ispunct and isgraph.

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-12-08 19:57:02 +00:00
parent c008ab0879
commit 6856cf6893
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326709

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;