aboutsummaryrefslogtreecommitdiff
path: root/sys/base/string/copyn.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/base/string/copyn.c')
-rw-r--r--sys/base/string/copyn.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/base/string/copyn.c b/sys/base/string/copyn.c
new file mode 100644
index 0000000..09c2879
--- /dev/null
+++ b/sys/base/string/copyn.c
@@ -0,0 +1,11 @@
+#include "internal.h"
+
+char *
+str·copyn(char *dst, char *src, int n)
+{
+ while(*src && n-- > 0)
+ *dst++ = *src++;
+
+ *dst = 0;
+ return dst;
+}