Added some more useful standard library functions.

pull/14/head
David Garske 2019-06-18 10:54:34 -07:00
parent 4b2a5f94c5
commit c46cf51156
1 changed files with 16 additions and 1 deletions

View File

@ -26,6 +26,11 @@
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
int islower(int c)
{
return (c >= 'a' && c <= 'z');
}
int isupper(int c) int isupper(int c)
{ {
return (c >= 'A' && c <= 'Z'); return (c >= 'A' && c <= 'Z');
@ -33,7 +38,17 @@ int isupper(int c)
int tolower(int c) int tolower(int c)
{ {
return isupper(c) ? (c) - 'A' + 'a' : c; return isupper(c) ? c - 'A' + 'a' : c;
}
int toupper(int c)
{
return islower(c) ? c - 'a' + 'A' : c;
}
int isalpha(int c)
{
return (isupper(c) || islower(c));
} }
void *memset(void *s, int c, size_t n) void *memset(void *s, int c, size_t n)