strncat.c (226B)
1 #include <string.h> 2 #undef strncat 3 4 char * 5 strncat(char * restrict dst, const char * restrict src, size_t n) 6 { 7 char *ret = dst; 8 9 while (*dst) 10 ++dst; 11 while (n-- > 0 && *src) 12 *dst++ = *src++; 13 *dst = '\0'; 14 return ret; 15 }