Add a simple implementation of strncpy

llvm-svn: 11672
This commit is contained in:
Chris Lattner 2004-02-20 20:15:47 +00:00
parent 23ea81ddfb
commit 5b22f55e54

View File

@ -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;