ref: 97426651206b41873b551f25c26f70967b769ef8
parent: 1b0aadd3da30f46989a7c24fb712bf0a25605f2a
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Feb 21 03:16:19 EST 2017
[libc] Add supports for strxfrm()
--- a/libc/src/Makefile
+++ b/libc/src/Makefile
@@ -3,6 +3,7 @@
LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \
strrchr.o strcat.o strncpy.o strncat.o strcoll.o \
+ strxfrm.o \
memset.o memcpy.o memmove.o memcmp.o memchr.o \
isalnum.o isalpha.o isascii.o isblank.o iscntrl.o isdigit.o \
isgraph.o islower.o isprint.o ispunct.o isspace.o isupper.o \
--- /dev/null
+++ b/libc/src/strxfrm.c
@@ -1,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <string.h>
+
+size_t
+strxfrm(char *dst, const char *src, size_t n)
+{
+ size_t len = strlen(src);
+
+ if (len < n)
+ strcpy(dst, src);
+ return len;
+}