Initial ascii-only versions

This commit is contained in:
Gitea 2020-12-13 04:55:41 -06:00
parent 62218ac1be
commit 92b4f1b83a
16 changed files with 88 additions and 0 deletions

5
ctype/isalnum.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int isalnum(int c) {
return (isalpha(c) || isdigit(c));
}

5
ctype/isalpha.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int isalpha(int c) {
return (isupper(c) || islower(c));
}

5
ctype/isascii.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int isascii(int c) {
return (c >= 0 && c <= 0177);
}

5
ctype/isblank.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int isblank(int c) {
return (c == ' ' || c == '\t');
}

5
ctype/iscntrl.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int iscntrl(int c) {
return ((c >= 0 && c < 32) || c == 127);
}

5
ctype/isdigit.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int isdigit(int c) {
return (c <= '9' && c >= '0');
}

5
ctype/isgraph.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int isgraph(int c) {
return (isalnum(c) || ispunct(c));
}

5
ctype/islower.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int islower(int c) {
return (c >= 'a' && c <= 'z');
}

5
ctype/isprint.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int isprint(int c) {
return (isgraph(c) || c == ' ');
}

5
ctype/ispunct.c Normal file
View File

@ -0,0 +1,5 @@
#include <stdio.h>
int ispunct(int c) {
return (c < 128 && !(isalnum(c) || iscntrl(c)));
}

13
ctype/isspace.c Normal file
View File

@ -0,0 +1,13 @@
#include <stdio.h>
int isspace(int c) {
switch(c) {
case ' ':
case '\f':
case '\n':
case '\r':
case '\t':
case '\v': return 1;
default: return 0;
}
}

5
ctype/isupper.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int isupper(int c) {
return (c >= 'A' && c <= 'Z');
}

5
ctype/isxdigit.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int isxdigit(int c) {
return (isdigit(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'));
}

5
ctype/toascii.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int toascii(int c) {
return (c & 0x7f)
}

5
ctype/tolower.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int tolower(int c) {
return (c + 32);
}

5
ctype/toupper.c Normal file
View File

@ -0,0 +1,5 @@
#include <ctype.h>
int tolower(int c) {
return (c - 32);
}