Migrated.
This commit is contained in:
@ -22,6 +22,7 @@ char *strncpy(char *dest, const char *src, size_t maxlen);
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
int strncmp(const char *s1, const char *s2, size_t n);
|
||||
char *strstr(const char *haystack, const char *needle);
|
||||
char *strchr(const char *s, int n);
|
||||
void *memcpy(void *dest, const void *src, size_t n);
|
||||
void *memcpy_long(void *dest, const void *src, size_t n);
|
||||
int memcmp(const void *s1, const void *s2, size_t n);
|
||||
|
||||
15
lib/string.c
15
lib/string.c
@ -80,6 +80,21 @@ int strncmp(const char *s1, const char *s2, size_t n)
|
||||
return *s1 - *s2;
|
||||
}
|
||||
|
||||
char *strchr(const char *s, int n) {
|
||||
char *p = (char *)s;
|
||||
while (1) {
|
||||
if (*p == n)
|
||||
{
|
||||
return p;
|
||||
} else if (*p == '\0') {
|
||||
break;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
char *strstr(const char *haystack, const char *needle)
|
||||
{
|
||||
int len = strlen(needle);
|
||||
|
||||
Reference in New Issue
Block a user