/* string.h: String manipulation. */ #ifndef _STRING_H #define _STRING_H #include #include #ifdef __cplusplus extern "C" { #endif /* Copy n bytes of memory from src to dest. */ void* memcpy(void* dest, const void* src, size_t n); /* Set n bytes of memory to the character c. */ void* memset(void* buf, int c, size_t n); /* Compare n bytes of two memory locations. */ int memcmp(const void* a, const void* b, size_t n); /* Copy n bytes of memory from src to dest, where src and dest may overlap. */ void* memmove(void* dest, const void* src, size_t n); /* Find the character c in n bytes of memory.*/ void* memchr(const void* buf, int c, size_t n); /* Return the length of a null-terminated string. */ size_t strlen(const char* str); /* Return the length of a fixed-size null-terminated string. */ size_t strnlen(const char* str, size_t max); /* Compare two null-terminated strings. */ int strcmp(const char* a, const char* b); /* Compare two fixed-size null-terminated strings. */ int strncmp(const char* a, const char* b, size_t max); /* Copy the null-terminated string src into dest. Should be avoided to prevent buffer overflow attacks. */ __deprecated char* strcpy(char* dest, const char* src); /* Copy the fixed-size null-terminated string src into dest. */ char* strncpy(char* dest, const char* src, size_t max); /* Concatenate the null-terminated string src onto dest. Should be avoided to prevent buffer overflow attacks. */ __deprecated char* strcat(char* dest, const char* src); /* Concatenate the fixed-size null-terminated string src onto dest. */ char* strncat(char* dest, const char* src, size_t max); /* Return a pointer to the first occurrence of the character c in str, or NULL if it could not be found. */ char* strchr(const char* str, int c); /* Return a pointer to the last occurrence of the character c in str, or NULL if it could not be found. */ char* strrchr(const char* str, int c); /* Return a heap-allocated copy of a string. */ char* strdup(const char* str); /* Return the human-readable description of an error number. */ char* strerror(int errnum); /* Return the length of the initial segment of str which consists only of bytes in accept. */ size_t strspn(const char* str, const char* accept); /* Return the length of the initial segment of str which consists only of bytes not in reject. */ size_t strcspn(const char* str, const char* reject); /* Return a pointer to the first occurrence of any of the characters in accept in s. */ char* strpbrk(const char* s, const char* delim); /* Separate a string into several tokens. */ char* strtok(char* str, const char* delim); /* Separate a string into several tokens. */ char* strtok_r(char* str, const char* delim, char** savep); /* Return a heap-allocated copy of a fixed-size string. */ char* strndup(const char* str, size_t max); /* Copy up to max bytes of src into dest, adding a null terminator at the end. */ size_t strlcpy(char* dest, const char* src, size_t max); /* Locate a string (needle) in another one (haystack). */ char* strstr(const char* haystack, const char* needle); #ifdef __cplusplus } #endif #endif