ref: 0ec2b19cef969fbe92ea5450c6832659eea3dc3a
parent: 5bb11ec674b1d8ea7693a5f9120280f1102c5796
author: mkf <mkf@cloud9p.org>
date: Tue Nov 28 02:31:03 EST 2023
import strncat
--- /dev/null
+++ b/libc/strncat.c
@@ -1,0 +1,20 @@
+#include <u.h>
+#include <libc.h>
+
+char*
+strncat(char *s1, char *s2, long n)
+{
+ char *os1;
+
+ os1 = s1;
+ while(*s1++)
+ ;
+ s1--;
+ while(*s1++ = *s2++)
+ if(--n < 0)
+ {
+ s1[-1] = 0;
+ break;
+ }
+ return os1;
+}