projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
54e4e20
)
Add a simple implementation of strncpy
author
Chris Lattner
<sabre@nondot.org>
Fri, 20 Feb 2004 20:15:47 +0000
(20:15 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Fri, 20 Feb 2004 20:15:47 +0000
(20:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11672
91177308
-0d34-0410-b5e6-
96231b3b80d8
runtime/GCCLibraries/libc/string.c
patch
|
blob
|
history
diff --git
a/runtime/GCCLibraries/libc/string.c
b/runtime/GCCLibraries/libc/string.c
index c13b11266cb8aeda85e8ffc55dbf0f16244a37c6..9cff5ece858e6d95d850d41d9939a1132064305c 100644
(file)
--- 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;