summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-08-11 04:11:46 +0000
committerEric Andersen <andersen@codepoet.org>2001-08-11 04:11:46 +0000
commit9c0d25bc675620344cfa3304f81c93e7105a2220 (patch)
treeefc8339cc048bc8665e2e2e7922b775f1dcd8378 /libc
parent246af1d52ea6e0ae2cd67b89bc5ab7c4e3e3303d (diff)
I rewrote strcat without any function calls.
Diffstat (limited to 'libc')
-rw-r--r--libc/string/string.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libc/string/string.c b/libc/string/string.c
index 4a367b561..d8b8e9f37 100644
--- a/libc/string/string.c
+++ b/libc/string/string.c
@@ -38,7 +38,15 @@ size_t strnlen (const char *string, size_t maxlen)
#ifdef L_strcat
char *strcat(char *dst, const char *src)
{
- strcpy(dst + strlen(dst), src);
+ register char *ptr = dst;
+
+ while (*ptr)
+ ptr++;
+
+ while (*src)
+ *ptr++ = *src++;
+ *ptr = '\0';
+
return dst;
}
#endif