commit 8983432321fac3cb410bb19beae46d891c438328 parent fbd4dc3ffdc99ec1ea9c3eb5af6340e8824ab310 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Thu, 16 Feb 2017 20:53:38 +0100 [libc] Add strcpy() Diffstat:
M | libc/src/Makefile | | | 2 | +- |
A | libc/src/strcpy.c | | | 13 | +++++++++++++ |
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/libc/src/Makefile b/libc/src/Makefile @@ -1,7 +1,7 @@ # See LICENSE file for copyright and license details. .POSIX: -LIBCOBJ = assert.o +LIBCOBJ = assert.o strcpy.o libc.a: $(LIBCOJB) ar $(ARFLAGS) $@ $? diff --git a/libc/src/strcpy.c b/libc/src/strcpy.c @@ -0,0 +1,13 @@ +/* See LICENSE file for copyright and license details. */ + +#include <string.h> + +char * +strcpy(char *dst, const char *src) +{ + char *ret = dst; + + while (*dst++ = *src++) + /* nothing */; + return ret; +}