scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 98871ab9a52db7d31579d8b1352563b3da837d78
parent 149ab2b982334ac3efa9034e595afff1b9df17ad
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 21 Feb 2017 08:16:19 +0100

[libc] Add supports for strxfrm()

Diffstat:
libc/src/Makefile | 1+
libc/src/strxfrm.c | 13+++++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git 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 \ diff --git a/libc/src/strxfrm.c b/libc/src/strxfrm.c @@ -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; +}