summaryrefslogtreecommitdiff
path: root/libc/string/string.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-08-11 04:17:52 +0000
committerEric Andersen <andersen@codepoet.org>2001-08-11 04:17:52 +0000
commit1459bf3832b1440e126d96d9177b88edde883956 (patch)
tree63a8984f8fcaa622bdc5b7a40969da217075917c /libc/string/string.c
parent9c0d25bc675620344cfa3304f81c93e7105a2220 (diff)
I just wrote a stpncpy() since someone wanted it
Diffstat (limited to 'libc/string/string.c')
-rw-r--r--libc/string/string.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libc/string/string.c b/libc/string/string.c
index d8b8e9f37..7ccc55733 100644
--- a/libc/string/string.c
+++ b/libc/string/string.c
@@ -79,6 +79,23 @@ char *stpcpy(char *dst, const char *src)
}
#endif
+/********************** Function stpncpy ************************************/
+
+#ifdef L_stpncpy
+char *stpncpy(char *dst, const char *src, size_t len)
+{
+ while (len--) {
+ if (*src)
+ *dst++ = *src++;
+ else
+ *dst++ = '\0';
+ }
+
+ return dst;
+}
+#endif
+
+
/********************** Function strcmp ************************************/
#ifdef L_strcmp