commit 6b7f10769a17d19ca3b3e2f3ed4e42d6ca9dd4c2 parent 008332b425b189c60ecff4e8a2d9096e3b7aa62b Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Thu, 16 Feb 2017 21:49:25 +0100 [libc] Add strcat() Diffstat:
M | libc/src/Makefile | | | 2 | +- |
A | libc/src/strcat.c | | | 15 | +++++++++++++++ |
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/libc/src/Makefile b/libc/src/Makefile @@ -2,7 +2,7 @@ .POSIX: LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \ - strrchr.o + strrchr.o strcat.o all: libc.a diff --git a/libc/src/strcat.c b/libc/src/strcat.c @@ -0,0 +1,15 @@ +/* See LICENSE file for copyright and license details. */ + +#include <string.h> + +char * +strcat(char *dst, const char *src) +{ + char *ret; + + for (ret = dst; *dst; ++dst) + /* nothing */; + while (*dst++ = *src++) + /* nothing */; + return ret; +}