From db777744aa07d47a571016b48fea82e53371fe2b Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 9 Jan 2002 19:41:02 +0000 Subject: Implement mempcpy --- libc/string/Makefile | 2 +- libc/string/string.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/string/Makefile b/libc/string/Makefile index 90a1b03a1..c7a4c128a 100644 --- a/libc/string/Makefile +++ b/libc/string/Makefile @@ -28,7 +28,7 @@ MSRC=string.c MOBJ=strlen.o strcat.o strcpy.o strchr.o strcmp.o strncat.o strncpy.o \ strncmp.o strrchr.o strdup.o strndup.o memcpy.o memccpy.o memset.o \ memmove.o memcmp.o memchr.o ffs.o strnlen.o strxfrm.o stpcpy.o \ - stpncpy.o memrchr.o + stpncpy.o memrchr.o mempcpy.o ifeq ($(HAS_LOCALE),true) MOBJ += strcoll.o diff --git a/libc/string/string.c b/libc/string/string.c index 591f875f9..176ef895b 100644 --- a/libc/string/string.c +++ b/libc/string/string.c @@ -308,6 +308,21 @@ void *memcpy(void *dst, const void *src, size_t len) } #endif +/********************** Function mempcpy ************************************/ + +#ifdef L_mempcpy +void *mempcpy(void *dst, const void *src, size_t len) +{ + register char *a = dst; + register const char *b = src; + + while (len--) + *a++ = *b++; + + return (void *) a; +} +#endif + /********************** Function memccpy ************************************/ #ifdef L_memccpy -- cgit v1.2.3