kern

annotate src/klibc/ctype.c @ 6:7e40f14617ed

forgot to add stdarg.h and stdlib.c
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 13 Jan 2011 20:24:10 +0200
parents
children
rev   line source
nuclear@2 1 #include "ctype.h"
nuclear@2 2
nuclear@2 3 int isalnum(int c)
nuclear@2 4 {
nuclear@2 5 return isalpha(c) || isdigit(c);
nuclear@2 6 }
nuclear@2 7
nuclear@2 8 int isalpha(int c)
nuclear@2 9 {
nuclear@2 10 return isupper(c) || islower(c);
nuclear@2 11 }
nuclear@2 12
nuclear@2 13 int isblank(int c)
nuclear@2 14 {
nuclear@2 15 return c == ' ' || c == '\t';
nuclear@2 16 }
nuclear@2 17
nuclear@2 18 int isdigit(int c)
nuclear@2 19 {
nuclear@2 20 return c >= '0' && c <= '9';
nuclear@2 21 }
nuclear@2 22
nuclear@2 23 int isupper(int c)
nuclear@2 24 {
nuclear@2 25 return c >= 'A' && c <= 'Z';
nuclear@2 26 }
nuclear@2 27
nuclear@2 28 int islower(int c)
nuclear@2 29 {
nuclear@2 30 return c >= 'a' && c <= 'z';
nuclear@2 31 }
nuclear@2 32
nuclear@2 33 int isgraph(int c)
nuclear@2 34 {
nuclear@2 35 return c > ' ' && c <= '~';
nuclear@2 36 }
nuclear@2 37
nuclear@2 38 int isprint(int c)
nuclear@2 39 {
nuclear@2 40 return isgraph(c) || c == ' ';
nuclear@2 41 }
nuclear@2 42
nuclear@2 43 int isspace(int c)
nuclear@2 44 {
nuclear@2 45 return isblank(c) || c == '\f' || c == '\n' || c == '\r' || c == '\v';
nuclear@2 46 }
nuclear@2 47
nuclear@2 48 int toupper(int c)
nuclear@2 49 {
nuclear@2 50 return islower(c) ? (c + ('A' - 'a')) : c;
nuclear@2 51 }
nuclear@2 52
nuclear@2 53 int tolower(int c)
nuclear@2 54 {
nuclear@2 55 return isupper(c) ? (c + ('A' - 'a')) : c;
nuclear@2 56 }