33 lines
666 B
C
33 lines
666 B
C
#ifndef _LIBC_STUB_
|
|
#define _LIBC_STUB_
|
|
|
|
#define NULL (void*)0
|
|
|
|
static int errno = 0;
|
|
|
|
#define EINVAL 1 /* Invalid argument */
|
|
#define EILSEQ 2 /* Illegal byte sequence */
|
|
#define E2BIG 3 /* Arg list too long */
|
|
|
|
typedef unsigned long size_t;
|
|
|
|
static inline int isupper(int c)
|
|
{
|
|
return (unsigned)c-'A' < 26;
|
|
}
|
|
|
|
static inline int tolower(int c)
|
|
{
|
|
if (isupper(c)) return c | 32;
|
|
return c;
|
|
}
|
|
|
|
static inline int strcasecmp(const char *_l, const char *_r)
|
|
{
|
|
const unsigned char *l=(unsigned char*)_l, *r=(unsigned char*)_r;
|
|
for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++);
|
|
return tolower(*l) - tolower(*r);
|
|
}
|
|
|
|
#endif // _LIBC_STUB_
|