From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- src/string/strlcat.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/string/strlcat.c (limited to 'src/string/strlcat.c') diff --git a/src/string/strlcat.c b/src/string/strlcat.c new file mode 100644 index 0000000..ef81209 --- /dev/null +++ b/src/string/strlcat.c @@ -0,0 +1,9 @@ +#define _BSD_SOURCE +#include + +size_t strlcat(char *d, const char *s, size_t n) +{ + size_t l = strnlen(d, n); + if (l == n) return l + strlen(s); + return l + strlcpy(d+l, s, n-l); +} -- cgit v1.2.3