2021-01-12 18:22:11 +00:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
|
|
|
#ifndef STRING_H
|
|
|
|
#define STRING_H
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
void *memcpy(void *s1, const void *s2, size_t n);
|
2021-01-29 11:03:23 +00:00
|
|
|
void *memmove(void *s1, const void *s2, size_t n);
|
2021-01-12 18:22:11 +00:00
|
|
|
int memcmp(const void *s1, const void *s2, size_t n);
|
|
|
|
void *memset(void *s, int c, size_t n);
|
2021-01-14 18:55:20 +00:00
|
|
|
void *memchr(const void *s, int c, size_t n);
|
2021-01-12 18:22:11 +00:00
|
|
|
char *strcpy(char *s1, const char *s2);
|
|
|
|
char *strncpy(char *s1, const char *s2, size_t n);
|
|
|
|
int strcmp(const char *s1, const char *s2);
|
2021-01-29 11:03:23 +00:00
|
|
|
int strncmp(const char *s1, const char *s2, size_t n);
|
2021-01-14 18:55:20 +00:00
|
|
|
size_t strlen(const char *s);
|
2021-03-07 16:31:14 +00:00
|
|
|
size_t strnlen(const char *s, size_t n);
|
2021-01-14 18:55:20 +00:00
|
|
|
char *strchr(const char *s, int c);
|
2021-01-29 11:03:23 +00:00
|
|
|
char *strrchr(const char *s, int c);
|
2021-01-12 18:22:11 +00:00
|
|
|
|
2021-10-18 09:17:15 +00:00
|
|
|
static inline int tolower(int c)
|
|
|
|
{
|
|
|
|
if (c >= 'A' && c <= 'Z')
|
|
|
|
return c - 'A' + 'a';
|
|
|
|
else
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int toupper(int c)
|
|
|
|
{
|
|
|
|
if (c >= 'a' && c <= 'z')
|
|
|
|
return c - 'a' + 'A';
|
|
|
|
else
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2021-01-12 18:22:11 +00:00
|
|
|
#endif
|