2022-12-21 08:29:33 +00:00
|
|
|
/*
|
|
|
|
|
* asbestOS: The best operating system ever made.
|
|
|
|
|
* Copyright (C) 2017 Max Wash
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int isupper(int c)
|
|
|
|
|
{
|
|
|
|
|
return (c >= 65 && c <= 90);
|
2022-12-21 08:29:33 +00:00
|
|
|
}
|
|
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int islower(int c)
|
|
|
|
|
{
|
|
|
|
|
return (c >= 97 && c <= 122);
|
2022-12-21 08:29:33 +00:00
|
|
|
}
|
|
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int toupper(int c)
|
|
|
|
|
{
|
|
|
|
|
if (!islower(c)) {
|
|
|
|
|
return c;
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
return c - 32;
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int tolower(int c)
|
|
|
|
|
{
|
|
|
|
|
if (!isupper(c)) {
|
|
|
|
|
return c;
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
return c + 32;
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int isdigit(int c)
|
|
|
|
|
{
|
|
|
|
|
return (c >= 48 && c <= 57);
|
2022-12-21 08:29:33 +00:00
|
|
|
}
|
|
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int isalpha(int c)
|
|
|
|
|
{
|
|
|
|
|
return (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
|
2022-12-21 08:29:33 +00:00
|
|
|
}
|
|
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int isalnum(int c)
|
|
|
|
|
{
|
|
|
|
|
return isalpha(c) | isdigit(c);
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int iscntrl(int c)
|
|
|
|
|
{
|
|
|
|
|
return (c <= 31) || (c == 127);
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int isprint(int c)
|
|
|
|
|
{
|
|
|
|
|
return (c >= 32 && c <= 126) || (c >= 128 && c <= 254);
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int isgraph(int c)
|
|
|
|
|
{
|
|
|
|
|
return isprint(c) && c != 32;
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int ispunct(int c)
|
|
|
|
|
{
|
|
|
|
|
return isgraph(c) && !isalnum(c);
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int isspace(int c)
|
|
|
|
|
{
|
|
|
|
|
return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\v')
|
|
|
|
|
|| (c == '\f') || (c == '\r');
|
|
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2026-02-08 12:17:27 +00:00
|
|
|
int isxdigit(int c)
|
|
|
|
|
{
|
|
|
|
|
return isdigit(c) || (c >= 65 && c <= 70) || (c >= 97 && c <= 102);
|
2022-12-21 08:29:33 +00:00
|
|
|
}
|