converted to ANSI C
This commit is contained in:
parent
fdf26a7f06
commit
85c9115d5b
1 changed files with 28 additions and 13 deletions
|
@ -3,59 +3,74 @@
|
||||||
*/
|
*/
|
||||||
/* $Header$ */
|
/* $Header$ */
|
||||||
|
|
||||||
int isalnum(c) { /* Alpha numeric character */
|
int isalnum(int c); /* Alpha numeric character */
|
||||||
|
int isalpha(int c); /* Alpha character */
|
||||||
|
int iscntrl(int c); /* Control character */
|
||||||
|
int isdigit(int c); /* Digit character */
|
||||||
|
int isgraph(int c); /* Graphical character */
|
||||||
|
int islower(int c); /* Lower case character */
|
||||||
|
int isprint(int c); /* Printable character */
|
||||||
|
int ispunct(int c); /* Punctuaction character */
|
||||||
|
int isspace(int c); /* Space character */
|
||||||
|
int isupper(int c); /* Upper case character */
|
||||||
|
int isxdigit(int c); /* Hexdecimal digit character */
|
||||||
|
|
||||||
|
int tolower(int c); /* Convert to lower case character */
|
||||||
|
int toupper(int c); /* Convert to upper case character */
|
||||||
|
|
||||||
|
int isalnum(int c) { /* Alpha numeric character */
|
||||||
return isdigit(c) || isalpha(c);
|
return isdigit(c) || isalpha(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
int isalpha(c) { /* Alpha character */
|
int isalpha(int c) { /* Alpha character */
|
||||||
return isupper(c) || islower(c);
|
return isupper(c) || islower(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
int iscntrl(c) { /* Control character */
|
int iscntrl(int c) { /* Control character */
|
||||||
return (c >= 0 && c <= 0x1f) || c == 0x7f;
|
return (c >= 0 && c <= 0x1f) || c == 0x7f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isdigit(c) { /* Digit character */
|
int isdigit(int c) { /* Digit character */
|
||||||
return (unsigned)(c - '0') < 10;
|
return (unsigned)(c - '0') < 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isgraph(c) { /* Graphical character */
|
int isgraph(int c) { /* Graphical character */
|
||||||
return isprint(c) && c != ' ';
|
return isprint(c) && c != ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
int islower(c) { /* Lower case character */
|
int islower(int c) { /* Lower case character */
|
||||||
return (unsigned)(c - 'a') < 26;
|
return (unsigned)(c - 'a') < 26;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isprint(c) { /* Printable character */
|
int isprint(int c) { /* Printable character */
|
||||||
return c > ' ' && c < 0x7f;
|
return c > ' ' && c < 0x7f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ispunct(c) { /* Punctuation character */
|
int ispunct(int c) { /* Punctuation character */
|
||||||
return isprint(c) && !(c == ' ' || isalnum(c));
|
return isprint(c) && !(c == ' ' || isalnum(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
int isspace(c) { /* Space character */
|
int isspace(int c) { /* Space character */
|
||||||
return c == ' ' || c == '\f' || c == '\n' ||
|
return c == ' ' || c == '\f' || c == '\n' ||
|
||||||
c == '\r' || c == '\t' || c == '\v';
|
c == '\r' || c == '\t' || c == '\v';
|
||||||
}
|
}
|
||||||
|
|
||||||
int isupper(c) { /* Upper case character */
|
int isupper(int c) { /* Upper case character */
|
||||||
return (unsigned)(c - 'A') < 26;
|
return (unsigned)(c - 'A') < 26;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isxdigit(c) { /* Hexdecimal digit character */
|
int isxdigit(int c) { /* Hexdecimal digit character */
|
||||||
return isdigit(c) ||
|
return isdigit(c) ||
|
||||||
(c >= 'A' && c <= 'F') ||
|
(c >= 'A' && c <= 'F') ||
|
||||||
(c >= 'a' && c <= 'f');
|
(c >= 'a' && c <= 'f');
|
||||||
}
|
}
|
||||||
|
|
||||||
int tolower(c) { /* Convert to lower case character */
|
int tolower(int c) { /* Convert to lower case character */
|
||||||
if (!isupper(c)) return c;
|
if (!isupper(c)) return c;
|
||||||
else return c - 'A' + 'a';
|
else return c - 'A' + 'a';
|
||||||
}
|
}
|
||||||
|
|
||||||
int toupper(c) { /* Convert to upper case character */
|
int toupper(int c) { /* Convert to upper case character */
|
||||||
if (!islower(c)) return c;
|
if (!islower(c)) return c;
|
||||||
else return c - 'a' + 'A';
|
else return c - 'a' + 'A';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue