2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-14 07:11:32 +00:00

Move tolower() etc to ctype.h as per ISO C

This commit is contained in:
Michael Brown 2007-01-26 03:25:19 +00:00
parent bf9ec8102f
commit afe4e011ac
3 changed files with 31 additions and 27 deletions

View File

@ -24,6 +24,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/* *** FROM string.c *** */

28
src/include/ctype.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef _CTYPE_H
#define _CTYPE_H
/** @file
*
* Character types
*/
#define isdigit(c) ((c & 0x04) != 0)
#define islower(c) ((c & 0x02) != 0)
//#define isspace(c) ((c & 0x20) != 0)
#define isupper(c) ((c & 0x01) != 0)
static inline unsigned char tolower(unsigned char c)
{
if (isupper(c))
c -= 'A'-'a';
return c;
}
static inline unsigned char toupper(unsigned char c)
{
if (islower(c))
c -= 'a'-'A';
return c;
}
#endif /* _CTYPE_H */

View File

@ -14,33 +14,8 @@
#ifndef ETHERBOOT_STRING_H
#define ETHERBOOT_STRING_H
#include "stddef.h"
#include "bits/string.h"
/* *** FROM ctype.h *** */
#define isdigit(c) ((c & 0x04) != 0)
#define islower(c) ((c & 0x02) != 0)
//#define isspace(c) ((c & 0x20) != 0)
#define isupper(c) ((c & 0x01) != 0)
static inline unsigned char tolower(unsigned char c)
{
if (isupper(c))
c -= 'A'-'a';
return c;
}
static inline unsigned char toupper(unsigned char c)
{
if (islower(c))
c -= 'a'-'A';
return c;
}
/* *** FROM string.h *** */
#include <stddef.h>
#include <bits/string.h>
int strnicmp(const char *s1, const char *s2, size_t len);
char * strcpy(char * dest,const char *src);