[hackers] [scc] [libc] Add supports for strxfrm() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 21 Feb 2017 08:16:48 +0100 (CET)

commit 98871ab9a52db7d31579d8b1352563b3da837d78
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Feb 21 08:16:19 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Feb 21 08:16:45 2017 +0100

    [libc] Add supports for strxfrm()

diff --git a/libc/src/Makefile b/libc/src/Makefile
index 555d4cb..022e6ff 100644
--- a/libc/src/Makefile
+++ b/libc/src/Makefile
_AT_@ -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 \
diff --git a/libc/src/strxfrm.c b/libc/src/strxfrm.c
new file mode 100644
index 0000000..8ea0140
--- /dev/null
+++ b/libc/src/strxfrm.c
_AT_@ -0,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;
+}
Received on Tue Feb 21 2017 - 08:16:48 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 21 2017 - 08:24:19 CET