aboutsummaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-20 20:15:47 +0000
committerChris Lattner <sabre@nondot.org>2004-02-20 20:15:47 +0000
commit3da125839d61e0bb603b56965ac026380ded42b0 (patch)
tree61cc525968d408be5229105f05681ff1f730e190 /runtime
parent54e4e20286ee28023867a5f4fa072eaae3674d2f (diff)
downloadexternal_llvm-3da125839d61e0bb603b56965ac026380ded42b0.zip
external_llvm-3da125839d61e0bb603b56965ac026380ded42b0.tar.gz
external_llvm-3da125839d61e0bb603b56965ac026380ded42b0.tar.bz2
Add a simple implementation of strncpy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime')
-rw-r--r--runtime/GCCLibraries/libc/string.c6
1 files changed, 6 insertions, 0 deletions
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 @@ char *strcpy(char *s1, const char *s2) {
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;