26 char*
strncat(
char* __restrict dst,
const char* __restrict src,
size_t maxlen)
28 const size_t dstlen =
strlen(dst);
29 const size_t srclen =
strnlen(src, maxlen);
37 const size_t cpylen = srclen < maxlen ? srclen : maxlen;
38 memcpy(dst + dstlen, src, cpylen);
39 dst[dstlen + cpylen] =
'\0';
size_t strnlen(const char *str, size_t maxlen)
Returns the length of the given null-terminated byte string.
size_t strlen(const char *str)
Returns the length of the given null-terminated byte string.
char * strncat(char *__restrict dst, const char *__restrict src, size_t maxlen)
Appends at most maxlen characters from the character array pointed to by src, to the end of the null-...
void * memcpy(void *__restrict dest, const void *__restrict src, size_t n)
Copies n characters from the object pointed to by src to the object pointed to by dest.