Add a simple implementation of strncpy


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11672 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/runtime/GCCLibraries/libc/string.c b/runtime/GCCLibraries/libc/string.c
index c13b112..9cff5ec 100644
--- a/runtime/GCCLibraries/libc/string.c
+++ b/runtime/GCCLibraries/libc/string.c
@@ -35,6 +35,12 @@
   return dest;
 }
 
+char *strncpy(char *s1, const char *s2, size_t n) {
+  char *dest = s1;
+  while (n-- && (*s1++ = *s2++));
+  return dest;
+}
+
 char *strcat(char *s1, const char *s2) {
   strcpy(s1+strlen(s1), s2);
   return s1;