1
/* Slooow, but small string operations, so that we don't have
2
to link libc5/glibc in.
3
Originally from linux/lib/string.c, which is
4
Copyright (C) 1991, 1992 Linus Torvalds
9
char * strncpy(char *dest, const char *src, size_t count)
13
while (count-- && (*dest++ = *src++) != '\0')
19
char *strcat(char *dest, const char *src)
23
while ((*dest++ = *src++) != '\0');
27
char *strncat(char *dest, const char *src, size_t n)
31
while (n && (*dest++ = *src++) != '\0') n--;
36
char * strrchr(const char * s, int c)
38
const char *p = s + strlen(s);
46
char *strdup(const char *str)
48
extern void *malloc(int);
50
ret = malloc(strlen(str) + 1);
55
__inline__ int tolower(int c)
57
if (c >= 'A' && c <= 'Z') return c - 'A' + 'a';
61
int strcasecmp(const char *cs,const char *ct)
63
register signed char __res;
65
if ((__res = tolower(*cs) - tolower(*ct++)) != 0 || !*cs++)
70
int strncasecmp(const char *cs,const char *ct,size_t n)
72
register signed char __res = 0;
74
if ((__res = tolower(*cs) - tolower(*ct++)) != 0 || !*cs++)
79
char * strstr(const char * s1,const char * s2)
89
if (!memcmp(s1,s2,l2))