/* 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); /* 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); /* Copy the null-terminated string src into dest. Should be avoided to prevent buffer overflow attacks. */ __deprecated char* strcpy(char* dest, const char* src); /* Concatenate the null-terminated string src onto dest. Should be avoided to prevent buffer overflow attacks. */ __deprecated char* strcat(char* dest, const char* src); /* 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); /* Separate a string into several tokens. */ char* strtok(char* str, const char* delim); /* 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); #ifdef __cplusplus } #endif #endif