commit | 3da125839d61e0bb603b56965ac026380ded42b0 | [log] [tgz] |
---|---|---|
author | Chris Lattner <sabre@nondot.org> | Fri Feb 20 20:15:47 2004 +0000 |
committer | Chris Lattner <sabre@nondot.org> | Fri Feb 20 20:15:47 2004 +0000 |
tree | 61cc525968d408be5229105f05681ff1f730e190 | |
parent | 54e4e20286ee28023867a5f4fa072eaae3674d2f [diff] [blame] |
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;