1570af302Sopenharmony_ci#define _BSD_SOURCE 2570af302Sopenharmony_ci#include <string.h> 3570af302Sopenharmony_ci 4570af302Sopenharmony_cisize_t strlcat(char *d, const char *s, size_t n) 5570af302Sopenharmony_ci{ 6570af302Sopenharmony_ci size_t l = strnlen(d, n); 7570af302Sopenharmony_ci if (l == n) return l + strlen(s); 8570af302Sopenharmony_ci return l + strlcpy(d+l, s, n-l); 9570af302Sopenharmony_ci} 10