#ifndef _STRING_H
#define _STRING_H

#include <bits/macros.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C"
{
#endif

    /* Copies n bytes from src to dst. */
    void* memcpy(void* dest, const void* src, size_t n);

    /* Sets n bytes of buf to c, cast to a character. */
    void* memset(void* buf, int c, size_t n);

    /* Clears n bytes of buf. */
    void* memclr(void* buf, size_t n);

    /* Returns the length of the string str. */
    size_t strlen(const char* str);

    /* Copies the string src into dest. This function is unsafe, use strncpy instead. */
    deprecated("strcpy is unsafe and should not be used; use strncpy instead") char* strcpy(char* dest,
                                                                                            const char* src);

    /* Copies at most max bytes from the string src into dest. */
    char* strncpy(char* dest, const char* src, size_t max);

    /* Returns a pointer to the first occurrence of the character c in str, or NULL if it is not found. */
    char* strchr(const char* str, int c);

    /* Concatenates the string src into dest. This function is unsafe, use strncat instead. */
    deprecated("strcat is unsafe and should not be used; use strncat instead") char* strcat(char* dest,
                                                                                            const char* src);

    /* Concatenates at most max bytes of the string src into dest. */
    char* strncat(char* dest, const char* src, size_t max);

    /* Returns the error string associated with the error number err. */
    char* strerror(int err);

#ifdef __cplusplus
}
#endif

#endif