Add stpcpy()

This commit is contained in:
Gregory Nutt
2014-01-09 14:08:48 -06:00
parent 75390a49a4
commit 4e2c140124
4 changed files with 57 additions and 42 deletions
+9 -8
View File
@@ -35,14 +35,15 @@
# Add the string C files to the build
CSRCS += lib_checkbase.c lib_isbasedigit.c lib_memset.c lib_memchr.c \
lib_memccpy.c lib_memcmp.c lib_memmove.c lib_skipspace.c \
lib_strcasecmp.c lib_strcat.c lib_strchr.c lib_strcpy.c lib_strcmp.c \
lib_strcspn.c lib_strdup.c lib_strerror.c lib_strlen.c lib_strnlen.c \
lib_strncasecmp.c lib_strncat.c lib_strncmp.c lib_strncpy.c \
lib_strndup.c lib_strcasestr.c lib_strpbrk.c lib_strrchr.c\
lib_strspn.c lib_strstr.c lib_strtok.c lib_strtokr.c lib_strtol.c \
lib_strtoll.c lib_strtoul.c lib_strtoull.c lib_strtod.c
CSRCS += lib_checkbase.c lib_isbasedigit.c lib_memset.c lib_memchr.c
CSRCS += lib_memccpy.c lib_memcmp.c lib_memmove.c lib_skipspace.c
CSRCS += lib_stpcpy.c lib_strcasecmp.c lib_strcat.c lib_strchr.c
CSRCS += lib_strcpy.c lib_strcmp.c lib_strcspn.c lib_strdup.c lib_strerror.c
CSRCS += lib_strlen.c lib_strnlen.c lib_strncasecmp.c lib_strncat.c
CSRCS += lib_strncmp.c lib_strncpy.c lib_strndup.c lib_strcasestr.c
CSRCS += lib_strpbrk.c lib_strrchr.c lib_strspn.c lib_strstr.c lib_strtok.c
CSRCS += lib_strtokr.c lib_strtol.c lib_strtoll.c lib_strtoul.c
CSRCS += lib_strtoull.c lib_strtod.c
ifneq ($(CONFIG_ARCH_MEMCPY),y)
ifeq ($(CONFIG_MEMCPY_VIK),y)
+15 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************
* libc/string/lib_strcpy.c
*
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009, 2011, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -42,11 +42,23 @@
#include <string.h>
/************************************************************************
* Global Functions
* Public Functions
************************************************************************/
/************************************************************************
* Name: strcpy
*
* Description:
* Copies the string pointed to by 'src' (including the terminating NUL
* character) into the array pointed to by 'des'.
*
* Returned value:
* The strcpy() function returns the 'dest' pointer
*
************************************************************************/
#ifndef CONFIG_ARCH_STRCPY
char *strcpy(char *dest, const char *src)
FAR char *strcpy(FAR char *dest, FAR const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0');