1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
/* Slooow, but small string operations, so that we don't have
to link libc5/glibc in.
These are needed before the second part is uncompressed.
Originally from linux/lib/string.c, which is
Copyright (C) 1991, 1992 Linus Torvalds
*/
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ long unsigned int
#endif
typedef __SIZE_TYPE__ size_t;
char *strcpy(char *dest, const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0');
return tmp;
}
int strcmp(const char *cs,const char *ct)
{
register signed char __res;
while (1)
if ((__res = *cs - *ct++) != 0 || !*cs++)
break;
return __res;
}
void *memset(void *s,int c,size_t count)
{
char *xs = (char *) s;
while (count--)
*xs++ = c;
return s;
}
void __bzero(void *s,size_t count)
{
memset(s,0,count);
}
void *memcpy(void *dest,const void *src,size_t count)
{
char *tmp = (char *) dest, *s = (char *) src;
while (count--)
*tmp++ = *s++;
return dest;
}
|