mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-13 11:04:27 -05:00
Main: libc/include/string.h: Add func "strchr"
This commit is contained in:
parent
f5966c8079
commit
68f99ab59f
2 changed files with 7 additions and 0 deletions
|
@ -13,6 +13,7 @@ void *memmove(void *dest, const void *src, size_t n);
|
|||
void *memchr(const void *s, int c, size_t n);
|
||||
void *memset(void *s, int c, size_t n);
|
||||
char *strcat(char *dest, const char *src);
|
||||
char *strchr(const char *s, int c);
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
char *strcpy(char *dest, const char *src);
|
||||
size_t strlen(const char *s);
|
||||
|
|
|
@ -58,6 +58,12 @@ char *strcat(char *dest, const char *src)
|
|||
return dest_start;
|
||||
}
|
||||
|
||||
char *strchr(const char *s, int c)
|
||||
{
|
||||
for (; *s != (char)c; ++s) if (*s == '\0') return NULL;
|
||||
return (char*)s;
|
||||
}
|
||||
|
||||
int strcmp(const char *s1, const char *s2)
|
||||
{
|
||||
for (; *s1; ++s1, ++s2) if (*s1 != *s2) return *s1 < *s2 ? -1 : 1;
|
||||
|
|
Loading…
Reference in a new issue