From ec3c37d1d40d7b288584c234f4c3e7a600f2353d Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 3 Apr 2025 12:30:34 -0400 Subject: new libs --- lib/stpncpy.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/stpncpy.c (limited to 'lib/stpncpy.c') diff --git a/lib/stpncpy.c b/lib/stpncpy.c new file mode 100644 index 0000000..4e0def6 --- /dev/null +++ b/lib/stpncpy.c @@ -0,0 +1,10 @@ +#include + +char *stpncpy(char *restrict dest, const char *restrict src, size_t n) +{ + char *d = dest; + for (; (*d = *src) && n; d++, src++, n--) + ; + memset(d, 0, n); + return d; +} -- cgit v1.2.3-freya