summaryrefslogtreecommitdiff
path: root/nuttx/lib/string
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/lib/string')
-rw-r--r--nuttx/lib/string/Make.defs58
-rw-r--r--nuttx/lib/string/lib_checkbase.c115
-rw-r--r--nuttx/lib/string/lib_isbasedigit.c105
-rw-r--r--nuttx/lib/string/lib_memccpy.c99
-rw-r--r--nuttx/lib/string/lib_memchr.c80
-rw-r--r--nuttx/lib/string/lib_memcmp.c74
-rw-r--r--nuttx/lib/string/lib_memcpy.c64
-rw-r--r--nuttx/lib/string/lib_memmove.c77
-rw-r--r--nuttx/lib/string/lib_memset.c188
-rw-r--r--nuttx/lib/string/lib_skipspace.c69
-rw-r--r--nuttx/lib/string/lib_strcasecmp.c65
-rw-r--r--nuttx/lib/string/lib_strcasestr.c134
-rw-r--r--nuttx/lib/string/lib_strcat.c62
-rw-r--r--nuttx/lib/string/lib_strchr.c78
-rw-r--r--nuttx/lib/string/lib_strcmp.c59
-rw-r--r--nuttx/lib/string/lib_strcpy.c55
-rw-r--r--nuttx/lib/string/lib_strcspn.c67
-rw-r--r--nuttx/lib/string/lib_strdup.c62
-rw-r--r--nuttx/lib/string/lib_strerror.c375
-rw-r--r--nuttx/lib/string/lib_strlen.c55
-rw-r--r--nuttx/lib/string/lib_strncasecmp.c70
-rw-r--r--nuttx/lib/string/lib_strncat.c62
-rw-r--r--nuttx/lib/string/lib_strncmp.c65
-rw-r--r--nuttx/lib/string/lib_strncpy.c57
-rw-r--r--nuttx/lib/string/lib_strndup.c93
-rw-r--r--nuttx/lib/string/lib_strnlen.c62
-rw-r--r--nuttx/lib/string/lib_strpbrk.c85
-rw-r--r--nuttx/lib/string/lib_strrchr.c68
-rw-r--r--nuttx/lib/string/lib_strspn.c66
-rw-r--r--nuttx/lib/string/lib_strstr.c104
-rw-r--r--nuttx/lib/string/lib_strtod.c241
-rw-r--r--nuttx/lib/string/lib_strtok.c87
-rw-r--r--nuttx/lib/string/lib_strtokr.c157
-rw-r--r--nuttx/lib/string/lib_strtol.c103
-rw-r--r--nuttx/lib/string/lib_strtoll.c107
-rw-r--r--nuttx/lib/string/lib_strtoul.c98
-rw-r--r--nuttx/lib/string/lib_strtoull.c100
-rw-r--r--nuttx/lib/string/lib_vikmemcpy.c348
38 files changed, 0 insertions, 3914 deletions
diff --git a/nuttx/lib/string/Make.defs b/nuttx/lib/string/Make.defs
deleted file mode 100644
index 191b9ffea..000000000
--- a/nuttx/lib/string/Make.defs
+++ /dev/null
@@ -1,58 +0,0 @@
-############################################################################
-# lib/string/Make.defs
-#
-# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt <gnutt@nuttx.org>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# 3. Neither the name NuttX nor the names of its contributors may be
-# used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-############################################################################
-
-# 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
-
-ifneq ($(CONFIG_ARCH_MEMCPY),y)
-ifeq ($(CONFIG_MEMCPY_VIK),y)
-CSRCS += lib_vikmemcpy.c
-else
-CSRCS += lib_memcpy.c
-endif
-endif
-
-# Add the string directory to the build
-
-DEPPATH += --dep-path string
-VPATH += :string
diff --git a/nuttx/lib/string/lib_checkbase.c b/nuttx/lib/string/lib_checkbase.c
deleted file mode 100644
index bc79ab2ce..000000000
--- a/nuttx/lib/string/lib_checkbase.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
- * lib/string/lib_checkbase.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-#include <ctype.h>
-
-#include "lib_internal.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lib_checkbase
- *
- * Description:
- * This is part of the strol() family implementation. This function checks
- * the initial part of a string to see if it can determine the numeric
- * base that is represented.
- *
- * Assumptions:
- * *ptr points to the first, non-whitespace character in the string.
- *
- ****************************************************************************/
-
-int lib_checkbase(int base, const char **pptr)
-{
- const char *ptr = *pptr;
-
- /* Check for unspecified base */
-
- if (!base)
- {
- /* Assume base 10 */
-
- base = 10;
-
- /* Check for leading '0' - that would signify octal or hex (or binary) */
-
- if (*ptr == '0')
- {
- /* Assume octal */
-
- base = 8;
- ptr++;
-
- /* Check for hexidecimal */
-
- if ((*ptr == 'X' || *ptr == 'x') &&
- lib_isbasedigit(ptr[1], 16, NULL))
- {
- base = 16;
- ptr++;
- }
- }
- }
-
- /* If it a hexidecimal representation, than discard any leading "0X" or "0x" */
-
- else if (base == 16)
- {
- if (ptr[0] == '0' && (ptr[1] == 'X' || ptr[1] == 'x'))
- {
- ptr += 2;
- }
- }
-
- /* Return the updated pointer and base */
-
- *pptr = ptr;
- return base;
-}
-
diff --git a/nuttx/lib/string/lib_isbasedigit.c b/nuttx/lib/string/lib_isbasedigit.c
deleted file mode 100644
index a2421bf2a..000000000
--- a/nuttx/lib/string/lib_isbasedigit.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
- * lib/string/lib_isbasedigit.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdbool.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "lib_internal.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lib_isbasedigit
- *
- * Description:
- * Given an ASCII character, ch, and a base (1-36) do two
- * things: 1) Determine if ch is a valid charcter, and 2)
- * convert ch to its binary value.
- *
- ****************************************************************************/
-
-bool lib_isbasedigit(int ch, int base, int *value)
-{
- bool ret = false;
- int tmp = 0;
-
- if (base <= 10)
- {
- if (ch >= '0' && ch <= base + '0' - 1)
- {
- tmp = ch - '0';
- ret = true;
- }
- }
- else if (base <= 36)
- {
- if (ch >= '0' && ch <= '9')
- {
- tmp = ch - '0';
- ret = true;
- }
- else if (ch >= 'a' && ch <= 'a' + base - 11)
- {
- tmp = ch - 'a' + 10;
- ret = true;
- }
- else if (ch >= 'A' && ch <= 'A' + base - 11)
- {
- tmp = ch - 'A' + 10;
- ret = true;
- }
- }
-
- if (value)
- {
- *value = tmp;
- }
- return ret;
-}
-
-
diff --git a/nuttx/lib/string/lib_memccpy.c b/nuttx/lib/string/lib_memccpy.c
deleted file mode 100644
index 1f3dbb52d..000000000
--- a/nuttx/lib/string/lib_memccpy.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
- * lib/string/lib_memccpy.c
- *
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-
-/****************************************************************************
- * Name: memccpy
- *
- * Description:
- * The memccpy() function copies bytes from memory area s2 into s1,
- * stopping after the first occurrence of byte c (converted to an unsigned
- * char) is copied, or after n bytes are copied, whichever comes first. If
- * copying takes place between objects that overlap, the behavior is
- * undefined.
- *
- * Returned Value:
- * The memccpy() function returns a pointer to the byte after the copy of c
- * in s1, or a null pointer if c was not found in the first n bytes of s2.
- *
- ****************************************************************************/
-
-FAR void *memccpy(FAR void *s1, FAR const void *s2, int c, size_t n)
-{
- FAR unsigned char *pout = (FAR unsigned char*)s1;
- FAR unsigned char *pin = (FAR unsigned char*)s2;
-
- /* Copy at most n bytes */
-
- while (n-- > 0)
- {
- /* Copy one byte */
-
- *pout = *pin++;
-
- /* Did we just copy the terminating byte c? */
-
- if (*pout == (unsigned char)c)
- {
- /* Yes return a pointer to the byte after the copy of c into s1 */
-
- return (FAR void *)pout;
- }
-
- /* No increment to the next destination location */
-
- pout++;
- }
-
- /* C was not found in the first n bytes of s2 */
-
- return NULL;
-}
diff --git a/nuttx/lib/string/lib_memchr.c b/nuttx/lib/string/lib_memchr.c
deleted file mode 100644
index e0dec8270..000000000
--- a/nuttx/lib/string/lib_memchr.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
- * lib/string/lib_memchr.c
- *
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: memchr
- *
- * Description:
- * The memchr() function locates the first occurrence of 'c' (converted to
- * an unsigned char) in the initial 'n' bytes (each interpreted as
- * unsigned char) of the object pointed to by s.
- *
- * Returned Value:
- * The memchr() function returns a pointer to the located byte, or a null
- * pointer if the byte does not occur in the object.
- *
- ****************************************************************************/
-
-FAR void *memchr(FAR const void *s, int c, size_t n)
-{
- FAR const unsigned char *p = (FAR const unsigned char *)s;
-
- if (s)
- {
- while (n--)
- {
- if (*p == (unsigned char)c)
- {
- return (FAR void *)p;
- }
-
- p++;
- }
- }
-
- return NULL;
-}
diff --git a/nuttx/lib/string/lib_memcmp.c b/nuttx/lib/string/lib_memcmp.c
deleted file mode 100644
index eb2e1fd12..000000000
--- a/nuttx/lib/string/lib_memcmp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/************************************************************
- * lib/string/lib_memcmp.c
- *
- * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************/
-
-/************************************************************
- * Compilation Switches
- ************************************************************/
-
-/************************************************************
- * Included Files
- ************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/************************************************************
- * Global Functions
- ************************************************************/
-
-#ifndef CONFIG_ARCH_MEMCMP
-int memcmp(const void *s1, const void *s2, size_t n)
-{
- unsigned char *p1 = (unsigned char *)s1;
- unsigned char *p2 = (unsigned char *)s2;
-
- while (n-- > 0)
- {
- if (*p1 < *p2)
- {
- return -1;
- }
- else if (*p1 > *p2)
- {
- return 1;
- }
-
- p1++;
- p2++;
- }
- return 0;
-}
-#endif
diff --git a/nuttx/lib/string/lib_memcpy.c b/nuttx/lib/string/lib_memcpy.c
deleted file mode 100644
index 3b62edbab..000000000
--- a/nuttx/lib/string/lib_memcpy.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
- * lib/string/lib_memcpy.c
- *
- * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: memcpy
- ****************************************************************************/
-
-#ifndef CONFIG_ARCH_MEMCPY
-FAR void *memcpy(FAR void *dest, FAR const void *src, size_t n)
-{
- FAR unsigned char *pout = (FAR unsigned char*)dest;
- FAR unsigned char *pin = (FAR unsigned char*)src;
- while (n-- > 0) *pout++ = *pin++;
- return dest;
-}
-#endif
diff --git a/nuttx/lib/string/lib_memmove.c b/nuttx/lib/string/lib_memmove.c
deleted file mode 100644
index 85cb79e17..000000000
--- a/nuttx/lib/string/lib_memmove.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/************************************************************
- * lib/string/lib_memmove.c
- *
- * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************/
-
-/************************************************************
- * Compilation Switches
- ************************************************************/
-
-/************************************************************
- * Included Files
- ************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/************************************************************
- * Global Functions
- ************************************************************/
-
-#ifndef CONFIG_ARCH_MEMMOVE
-void *memmove(void *dest, const void *src, size_t count)
-{
- char *tmp, *s;
- if (dest <= src)
- {
- tmp = (char*) dest;
- s = (char*) src;
- while (count--)
- {
- *tmp++ = *s++;
- }
- }
- else
- {
- tmp = (char*) dest + count;
- s = (char*) src + count;
- while (count--)
- {
- *--tmp = *--s;
- }
- }
-
- return dest;
-}
-#endif
diff --git a/nuttx/lib/string/lib_memset.c b/nuttx/lib/string/lib_memset.c
deleted file mode 100644
index 31c386e92..000000000
--- a/nuttx/lib/string/lib_memset.c
+++ /dev/null
@@ -1,188 +0,0 @@
-
-/****************************************************************************
- * lib/string/lib_memset.c
- *
- * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <sys/types.h>
-
-#include <stdint.h>
-#include <string.h>
-#include <assert.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Can't support CONFIG_MEMSET_64BIT if the platform does not have 64-bit
- * integer types.
- */
-
-#ifndef CONFIG_HAVE_LONG_LONG
-# undef CONFIG_MEMSET_64BIT
-#endif
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-#ifndef CONFIG_ARCH_MEMSET
-void *memset(void *s, int c, size_t n)
-{
-#ifdef CONFIG_MEMSET_OPTSPEED
- /* This version is optimized for speed (you could do better
- * still by exploiting processor caching or memory burst
- * knowledge.)
- */
-
- uintptr_t addr = (uintptr_t)s;
- uint16_t val16 = ((uint16_t)c << 8) | (uint16_t)c;
- uint32_t val32 = ((uint32_t)val16 << 16) | (uint32_t)val16;
-#ifdef CONFIG_MEMSET_64BIT
- uint64_t val64 = ((uint64_t)val32 << 32) | (uint64_t)val32;
-#endif
-
- /* Make sure that there is something to be cleared */
-
- if (n > 0)
- {
- /* Align to a 16-bit boundary */
-
- if ((addr & 1) != 0)
- {
- *(uint8_t*)addr = (uint8_t)c;
- addr += 1;
- n -= 1;
- }
-
- /* Check if there are at least 16-bits left to be written */
-
- if (n >= 2)
- {
- /* Align to a 32-bit boundary (we know that the destination
- * address is already aligned to at least a 16-bit boundary).
- */
-
- if ((addr & 3) != 0)
- {
- *(uint16_t*)addr = val16;
- addr += 2;
- n -= 2;
- }
-
-#ifndef CONFIG_MEMSET_64BIT
- /* Loop while there are at least 32-bits left to be written */
-
- while (n >= 4)
- {
- *(uint32_t*)addr = val32;
- addr += 4;
- n -= 4;
- }
-#else
- /* Check if there are at least 32-bits left to be written */
-
- if (n >= 4)
- {
- /* Align to a 64-bit boundary (we know that the destination
- * address is already aligned to at least a 32-bit boundary).
- */
-
- if ((addr & 7) != 0)
- {
- *(uint32_t*)addr = val32;
- addr += 4;
- n -= 4;
- }
-
- /* Loop while there are at least 64-bits left to be written */
-
- while (n >= 8)
- {
- *(uint64_t*)addr = val64;
- addr += 8;
- n -= 8;
- }
- }
-#endif
- }
-
-#ifdef CONFIG_MEMSET_64BIT
- /* We may get here with n in the range 0..7. If n >= 4, then we should
- * have 64-bit alignment.
- */
-
- if (n >= 4)
- {
- *(uint32_t*)addr = val32;
- addr += 4;
- n -= 4;
- }
-#endif
-
- /* We may get here under the following conditions:
- *
- * n = 0, addr may or may not be aligned
- * n = 1, addr is aligned to at least a 16-bit boundary
- * n = 2, addr is aligned to a 32-bit boundary
- * n = 3, addr is aligned to a 32-bit boundary
- */
-
- if (n >= 2)
- {
- *(uint16_t*)addr = val16;
- addr += 2;
- n -= 2;
- }
-
- if (n >= 1)
- {
- *(uint8_t*)addr = (uint8_t)c;
- }
- }
-#else
- /* This version is optimized for size */
-
- unsigned char *p = (unsigned char*)s;
- while (n-- > 0) *p++ = c;
-#endif
- return s;
-}
-#endif
diff --git a/nuttx/lib/string/lib_skipspace.c b/nuttx/lib/string/lib_skipspace.c
deleted file mode 100644
index b4e6588e5..000000000
--- a/nuttx/lib/string/lib_skipspace.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
- * lib/string/lib_skipspace.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-#include <ctype.h>
-#include "lib_internal.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lib_skipspace
- *
- * Description:
- * Skip over leading whitespace
- *
- ****************************************************************************/
-
-void lib_skipspace(const char **pptr)
-{
- const char *ptr = *pptr;
- while (isspace(*ptr)) ptr++;
- *pptr = ptr;
-}
-
-
diff --git a/nuttx/lib/string/lib_strcasecmp.c b/nuttx/lib/string/lib_strcasecmp.c
deleted file mode 100644
index d4aa8cc03..000000000
--- a/nuttx/lib/string/lib_strcasecmp.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strcasecmp.c
- *
- * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- *****************************************************************************/
-
-/****************************************************************************
- * Included Files
- *****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-#include <ctype.h>
-
-/****************************************************************************
- * Public Functions
- *****************************************************************************/
-
-#ifndef CONFIG_ARCH_STRCMP
-int strcasecmp(const char *cs, const char *ct)
-{
- int result;
- for (;;)
- {
- if ((result = (int)toupper(*cs) - (int)toupper(*ct)) != 0 || !*cs)
- {
- break;
- }
-
- cs++;
- ct++;
- }
- return result;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strcasestr.c b/nuttx/lib/string/lib_strcasestr.c
deleted file mode 100644
index 23f0ab57e..000000000
--- a/nuttx/lib/string/lib_strcasestr.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strstr.c
- *
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use str source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions str binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer str
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-#include <ctype.h>
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-static FAR char *strcasechr(FAR const char *s, int uc)
-{
- register char ch;
-
- if (s)
- {
- for (; *s; s++)
- {
- ch = *s;
- if (toupper(ch) == uc)
- {
- return (FAR char*)s;
- }
- }
- }
-
- return NULL;
-}
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-FAR char *strcasestr(FAR const char *str, FAR const char *substr)
-{
- const char *candidate; /* Candidate in str with matching start character */
- char ch; /* First character of the substring */
- int len; /* The length of the substring */
-
- /* Special case the empty substring */
-
- len = strlen(substr);
- ch = *substr;
-
- if (!ch)
- {
- /* We'll say that an empty substring matches at the beginning of
- * the string
- */
-
- return (char*)str;
- }
-
- /* Search for the substring */
-
- candidate = str;
- ch = toupper(ch);
-
- for (;;)
- {
- /* strcasechr() will return a pointer to the next occurrence of the
- * character ch in the string (ignoring case)
- */
-
- candidate = strcasechr(candidate, ch);
- if (!candidate || strlen(candidate) < len)
- {
- /* First character of the substring does not appear in the string
- * or the remainder of the string is not long enough to contain the
- * substring.
- */
-
- return NULL;
- }
-
- /* Check if this is the beginning of a matching substring (ignoring case) */
-
- if (strncasecmp(candidate, substr, len) == 0)
- {
- /* Yes.. return the pointer to the first occurrence of the matching
- * substring.
- */
-
- return (char*)candidate;
- }
-
- /* No, find the next candidate after this one */
-
- candidate++;
- }
-
- /* Won't get here, but some compilers might complain */
-
- return NULL;
-}
-
diff --git a/nuttx/lib/string/lib_strcat.c b/nuttx/lib/string/lib_strcat.c
deleted file mode 100644
index 20350fec0..000000000
--- a/nuttx/lib/string/lib_strcat.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strcat.c
- *
- * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-#ifndef CONFIG_ARCH_STRCAT
-char *strcat(char *dest, const char *src)
-{
- char *ret = dest;
-
- dest += strlen(dest);
- while (*src != '\0')
- {
- *dest++ = *src++;
- }
- *dest = '\0';
-
- return ret;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strchr.c b/nuttx/lib/string/lib_strchr.c
deleted file mode 100644
index d0bd22a0e..000000000
--- a/nuttx/lib/string/lib_strchr.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strchr.c
- *
- * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strchr
- *
- * Description:
- * The strchr() function locates the first occurrence of 'c' (converted to
- * a char) in the string pointed to by 's'. The terminating null byte is
- * considered to be part of the string.
- *
- * Returned Value:
- * Upon completion, strchr() returns a pointer to the byte, or a null
- * pointer if the byte was not found.
- *
- ****************************************************************************/
-
-#ifndef CONFIG_ARCH_STRCHR
-FAR char *strchr(FAR const char *s, int c)
-{
- if (s)
- {
- for (; *s; s++)
- {
- if (*s == c)
- {
- return (FAR char *)s;
- }
- }
- }
-
- return NULL;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strcmp.c b/nuttx/lib/string/lib_strcmp.c
deleted file mode 100644
index 0e3eee890..000000000
--- a/nuttx/lib/string/lib_strcmp.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strcmp.c
- *
- * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- *****************************************************************************/
-
-/****************************************************************************
- * Included Files
- *****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-/****************************************************************************
- * Public Functions
- *****************************************************************************/
-
-#ifndef CONFIG_ARCH_STRCMP
-int strcmp(const char *cs, const char *ct)
-{
- register signed char result;
- for (;;)
- {
- if ((result = *cs - *ct++) != 0 || !*cs++)
- break;
- }
- return result;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strcpy.c b/nuttx/lib/string/lib_strcpy.c
deleted file mode 100644
index e2f70b94e..000000000
--- a/nuttx/lib/string/lib_strcpy.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/************************************************************************
- * lib/string/lib_strcpy.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************/
-
-/************************************************************************
- * Included Files
- ************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-/************************************************************************
- * Global Functions
- ************************************************************************/
-
-#ifndef CONFIG_ARCH_STRCPY
-char *strcpy(char *dest, const char *src)
-{
- char *tmp = dest;
- while ((*dest++ = *src++) != '\0');
- return tmp;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strcspn.c b/nuttx/lib/string/lib_strcspn.c
deleted file mode 100644
index 9da89241c..000000000
--- a/nuttx/lib/string/lib_strcspn.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strcspn.c
- *
- * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strcspn
- *
- * Description:
- * strspn() calculates the length of the initial segment of s which
- * consists entirely of characters not in reject
- *
- ****************************************************************************/
-
-size_t strcspn(const char *s, const char *reject)
-{
- size_t i;
- for (i = 0; s[i] && strchr(reject, s[i]) == NULL; i++);
- return i;
-}
-
diff --git a/nuttx/lib/string/lib_strdup.c b/nuttx/lib/string/lib_strdup.c
deleted file mode 100644
index 44a0cbc0d..000000000
--- a/nuttx/lib/string/lib_strdup.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/************************************************************************
- * lib/string//lib_strdup.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************/
-
-/************************************************************************
- * Included Files
- ************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-#include "lib_internal.h"
-
-/************************************************************************
- * Global Functions
- ************************************************************************/
-
-FAR char *strdup(const char *s)
-{
- FAR char *news = NULL;
- if (s)
- {
- news = (FAR char*)lib_malloc(strlen(s) + 1);
- if (news)
- {
- strcpy(news, s);
- }
- }
- return news;
-}
diff --git a/nuttx/lib/string/lib_strerror.c b/nuttx/lib/string/lib_strerror.c
deleted file mode 100644
index 249f695c1..000000000
--- a/nuttx/lib/string/lib_strerror.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/************************************************************************
- * lib/string/lib_strerror.c
- *
- * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************/
-
-/************************************************************************
- * Included Files
- ************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-#include <string.h>
-#include <errno.h>
-
-/************************************************************************
- * Definitions
- ************************************************************************/
-
-/************************************************************************
- * Private Types
- ************************************************************************/
-
-struct errno_strmap_s
-{
- uint8_t errnum;
- const char *str;
-};
-
-/************************************************************************
- * Private Data
- ************************************************************************/
-
-#ifdef CONFIG_LIBC_STRERROR
-
-/* This table maps all error numbers to descriptive strings.
- * The only assumption that the code makes with regard to this
- * this table is that it is ordered by error number.
- *
- * The size of this table is quite large. Its size can be
- * reduced by eliminating some of the more obscure error
- * strings.
- */
-
-#ifndef CONFIG_LIBC_STRERROR_SHORT
-
-static const struct errno_strmap_s g_errnomap[] =
-{
- { EPERM, EPERM_STR },
- { ENOENT, ENOENT_STR },
- { ESRCH, ESRCH_STR },
- { EINTR, EINTR_STR },
- { EIO, EIO_STR },
- { ENXIO, ENXIO_STR },
- { E2BIG, E2BIG_STR },
- { ENOEXEC, ENOEXEC_STR },
- { EBADF, EBADF_STR },
- { ECHILD, ECHILD_STR },
- { EAGAIN, EAGAIN_STR },
- { ENOMEM, ENOMEM_STR },
- { EACCES, EACCES_STR },
- { EFAULT, EFAULT_STR },
- { ENOTBLK, ENOTBLK_STR },
- { EBUSY, EBUSY_STR },
- { EEXIST, EEXIST_STR },
- { EXDEV, EXDEV_STR },
- { ENODEV, ENODEV_STR },
- { ENOTDIR, ENOTDIR_STR },
- { EISDIR, EISDIR_STR },
- { EINVAL, EINVAL_STR },
- { ENFILE, ENFILE_STR },
- { EMFILE, EMFILE_STR },
- { ENOTTY, ENOTTY_STR },
- { ETXTBSY, ETXTBSY_STR },
- { EFBIG, EFBIG_STR },
- { ENOSPC, ENOSPC_STR },
- { ESPIPE, ESPIPE_STR },
- { EROFS, EROFS_STR },
- { EMLINK, EMLINK_STR },
- { EPIPE, EPIPE_STR },
- { EDOM, EDOM_STR },
- { ERANGE, ERANGE_STR },
- { EDEADLK, EDEADLK_STR },
- { ENAMETOOLONG, ENAMETOOLONG_STR },
- { ENOLCK, ENOLCK_STR },
- { ENOSYS, ENOSYS_STR },
- { ENOTEMPTY, ENOTEMPTY_STR },
- { ELOOP, ELOOP_STR },
- { ENOMSG, ENOMSG_STR },
- { EIDRM, EIDRM_STR },
- { ECHRNG, ECHRNG_STR },
- { EL2NSYNC, EL2NSYNC_STR },
- { EL3HLT, EL3HLT_STR },
- { EL3RST, EL3RST_STR },
- { ELNRNG, ELNRNG_STR },
- { EUNATCH, EUNATCH_STR },
- { ENOCSI, ENOCSI_STR },
- { EL2HLT, EL2HLT_STR },
- { EBADE, EBADE_STR },
- { EBADR, EBADR_STR },
- { EXFULL, EXFULL_STR },
- { ENOANO, ENOANO_STR },
- { EBADRQC, EBADRQC_STR },
- { EBADSLT, EBADSLT_STR },
- { EBFONT, EBFONT_STR },
- { ENOSTR, ENOSTR_STR },
- { ENODATA, ENODATA_STR },
- { ETIME, ETIME_STR },
- { ENOSR, ENOSR_STR },
- { ENONET, ENONET_STR },
- { ENOPKG, ENOPKG_STR },
- { EREMOTE, EREMOTE_STR },
- { ENOLINK, ENOLINK_STR },
- { EADV, EADV_STR },
- { ESRMNT, ESRMNT_STR },
- { ECOMM, ECOMM_STR },
- { EPROTO, EPROTO_STR },
- { EMULTIHOP, EMULTIHOP_STR },
- { EDOTDOT, EDOTDOT_STR },
- { EBADMSG, EBADMSG_STR },
- { EOVERFLOW, EOVERFLOW_STR },
- { ENOTUNIQ, ENOTUNIQ_STR },
- { EBADFD, EBADFD_STR },
- { EREMCHG, EREMCHG_STR },
- { ELIBACC, ELIBACC_STR },
- { ELIBBAD, ELIBBAD_STR },
- { ELIBSCN, ELIBSCN_STR },
- { ELIBMAX, ELIBMAX_STR },
- { ELIBEXEC, ELIBEXEC_STR },
- { EILSEQ, EILSEQ_STR },
- { ERESTART, ERESTART_STR },
- { ESTRPIPE, ESTRPIPE_STR },
- { EUSERS, EUSERS_STR },
- { ENOTSOCK, ENOTSOCK_STR },
- { EDESTADDRREQ, EDESTADDRREQ_STR },
- { EMSGSIZE, EMSGSIZE_STR },
- { EPROTOTYPE, EPROTOTYPE_STR },
- { ENOPROTOOPT, ENOPROTOOPT_STR },
- { EPROTONOSUPPORT, EPROTONOSUPPORT_STR },
- { ESOCKTNOSUPPORT, ESOCKTNOSUPPORT_STR },
- { EOPNOTSUPP, EOPNOTSUPP_STR },
- { EPFNOSUPPORT, EPFNOSUPPORT_STR },
- { EAFNOSUPPORT, EAFNOSUPPORT_STR },
- { EADDRINUSE, EADDRINUSE_STR },
- { EADDRNOTAVAIL, EADDRNOTAVAIL_STR },
- { ENETDOWN, ENETDOWN_STR },
- { ENETUNREACH, ENETUNREACH_STR },
- { ENETRESET, ENETRESET_STR },
- { ECONNABORTED, ECONNABORTED_STR },
- { ECONNRESET, ECONNRESET_STR },
- { ENOBUFS, ENOBUFS_STR },
- { EISCONN, EISCONN_STR },
- { ENOTCONN, ENOTCONN_STR },
- { ESHUTDOWN, ESHUTDOWN_STR },
- { ETOOMANYREFS, ETOOMANYREFS_STR },
- { ETIMEDOUT, ETIMEDOUT_STR },
- { ECONNREFUSED, ECONNREFUSED_STR },
- { EHOSTDOWN, EHOSTDOWN_STR },
- { EHOSTUNREACH, EHOSTUNREACH_STR },
- { EALREADY, EALREADY_STR },
- { EINPROGRESS, EINPROGRESS_STR },
- { ESTALE, ESTALE_STR },
- { EUCLEAN, EUCLEAN_STR },
- { ENOTNAM, ENOTNAM_STR },
- { ENAVAIL, ENAVAIL_STR },
- { EISNAM, EISNAM_STR },
- { EREMOTEIO, EREMOTEIO_STR },
- { EDQUOT, EDQUOT_STR },
- { ENOMEDIUM, ENOMEDIUM_STR },
- { EMEDIUMTYPE, EMEDIUMTYPE_STR }
-};
-
-#else /* CONFIG_LIBC_STRERROR_SHORT */
-
-static const struct errno_strmap_s g_errnomap[] =
-{
- { EPERM, "EPERM" },
- { ENOENT, "ENOENT" },
- { ESRCH, "ESRCH" },
- { EINTR, "EINTR" },
- { EIO, "EIO" },
- { ENXIO, "ENXIO" },
- { E2BIG, "E2BIG" },
- { ENOEXEC, "ENOEXEC" },
- { EBADF, "EBADF" },
- { ECHILD, "ECHILD" },
- { EAGAIN, "EAGAIN" },
- { ENOMEM, "ENOMEM" },
- { EACCES, "EACCES" },
- { EFAULT, "EFAULT" },
- { ENOTBLK, "ENOTBLK" },
- { EBUSY, "EBUSY" },
- { EEXIST, "EEXIST" },
- { EXDEV, "EXDEV" },
- { ENODEV, "ENODEV" },
- { ENOTDIR, "ENOTDIR" },
- { EISDIR, "EISDIR" },
- { EINVAL, "EINVAL" },
- { ENFILE, "ENFILE" },
- { EMFILE, "EMFILE" },
- { ENOTTY, "ENOTTY" },
- { ETXTBSY, "ETXTBSY" },
- { EFBIG, "EFBIG" },
- { ENOSPC, "ENOSPC" },
- { ESPIPE, "ESPIPE" },
- { EROFS, "EROFS" },
- { EMLINK, "EMLINK" },
- { EPIPE, "EPIPE" },
- { EDOM, "EDOM" },
- { ERANGE, "ERANGE" },
- { EDEADLK, "EDEADLK" },
- { ENAMETOOLONG, "ENAMETOOLONG" },
- { ENOLCK, "ENOLCK" },
- { ENOSYS, "ENOSYS" },
- { ENOTEMPTY, "ENOTEMPTY" },
- { ELOOP, "ELOOP" },
- { ENOMSG, "ENOMSG" },
- { EIDRM, "EIDRM" },
- { ECHRNG, "ECHRNG" },
- { EL2NSYNC, "EL2NSYNC" },
- { EL3HLT, "EL3HLT" },
- { EL3RST, "EL3RST" },
- { EL3RST, "EL3RST" },
- { EUNATCH, "EUNATCH" },
- { ENOCSI, "ENOCSI" },
- { EL2HLT, "EL2HLT" },
- { EBADE, "EBADE" },
- { EBADR, "EBADR" },
- { EXFULL, "EXFULL" },
- { ENOANO, "ENOANO" },
- { EBADRQC, "EBADRQC" },
- { EBADSLT, "EBADSLT" },
- { EBFONT, "EBFONT" },
- { ENOSTR, "ENOSTR" },
- { ENODATA, "ENODATA" },
- { ETIME, "ETIME" },
- { ENOSR, "ENOSR" },
- { ENONET, "ENONET" },
- { ENOPKG, "ENOPKG" },
- { EREMOTE, "EREMOTE" },
- { ENOLINK, "ENOLINK" },
- { EADV, "EADV" },
- { ESRMNT, "ESRMNT" },
- { ECOMM, "ECOMM" },
- { EPROTO, "EPROTO" },
- { EMULTIHOP, "EMULTIHOP" },
- { EDOTDOT, "EDOTDOT" },
- { EBADMSG, "EBADMSG" },
- { EOVERFLOW, "EOVERFLOW" },
- { ENOTUNIQ, "ENOTUNIQ" },
- { EBADFD, "EBADFD" },
- { EREMCHG, "EREMCHG" },
- { ELIBACC, "ELIBACC" },
- { ELIBBAD, "ELIBBAD" },
- { ELIBSCN, "ELIBSCN" },
- { ELIBMAX, "ELIBMAX" },
- { ELIBEXEC, "ELIBEXEC" },
- { EILSEQ, "EILSEQ" },
- { ERESTART, "ERESTART" },
- { ESTRPIPE, "ESTRPIPE" },
- { EUSERS, "EUSERS" },
- { ENOTSOCK, "ENOTSOCK" },
- { EDESTADDRREQ, "EDESTADDRREQ" },
- { EMSGSIZE, "EMSGSIZE" },
- { EPROTOTYPE, "EPROTOTYPE" },
- { ENOPROTOOPT, "ENOPROTOOPT" },
- { EPROTONOSUPPORT, "EPROTONOSUPPORT" },
- { ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT" },
- { EOPNOTSUPP, "EOPNOTSUPP" },
- { EPFNOSUPPORT, "EPFNOSUPPORT" },
- { EAFNOSUPPORT, "EAFNOSUPPORT" },
- { EADDRINUSE, "EADDRINUSE" },
- { EADDRNOTAVAIL, "EADDRNOTAVAIL" },
- { ENETDOWN, "ENETDOWN" },
- { ENETUNREACH, "ENETUNREACH" },
- { ENETRESET, "ENETRESET" },
- { ECONNABORTED, "ECONNABORTED" },
- { ECONNRESET, "ECONNRESET" },
- { ENOBUFS, "ENOBUFS" },
- { EISCONN, "EISCONN" },
- { ENOTCONN, "ENOTCONN" },
- { ESHUTDOWN, "ESHUTDOWN" },
- { ETOOMANYREFS, "ETOOMANYREFS" },
- { ETIMEDOUT, "ETIMEDOUT" },
- { ECONNREFUSED, "ECONNREFUSED" },
- { EHOSTDOWN, "EHOSTDOWN" },
- { EHOSTUNREACH, "EHOSTUNREACH" },
- { EALREADY, "EALREADY" },
- { EINPROGRESS, "EINPROGRESS" },
- { ESTALE, "ESTALE" },
- { EUCLEAN, "EUCLEAN" },
- { ENOTNAM, "ENOTNAM" },
- { ENAVAIL, "ENAVAIL" },
- { EISNAM, "EISNAM" },
- { EREMOTEIO, "EREMOTEIO" },
- { EDQUOT, "EDQUOT" },
- { ENOMEDIUM, "ENOMEDIUM" },
- { EMEDIUMTYPE, "EMEDIUMTYPE" }
-};
-
-#endif /* CONFIG_LIBC_STRERROR_SHORT */
-
-#define NERRNO_STRS (sizeof(g_errnomap) / sizeof(struct errno_strmap_s))
-
-#endif /* CONFIG_LIBC_STRERROR */
-
-/************************************************************************
- * Private Functions
- ************************************************************************/
-
-/************************************************************************
- * Public Functions
- ************************************************************************/
-
-/************************************************************************
- * Name: strerror
- ************************************************************************/
-
-FAR const char *strerror(int errnum)
-{
-#ifdef CONFIG_LIBC_STRERROR
- int ndxlow = 0;
- int ndxhi = NERRNO_STRS - 1;
- int ndxmid;
-
- do
- {
- ndxmid = (ndxlow + ndxhi) >> 1;
- if (errnum > g_errnomap[ndxmid].errnum)
- {
- ndxlow = ndxmid + 1;
- }
- else if (errnum < g_errnomap[ndxmid].errnum)
- {
- ndxhi = ndxmid - 1;
- }
- else
- {
- return g_errnomap[ndxmid].str;
- }
- }
- while (ndxlow <= ndxhi);
-#endif
- return "Unknown error";
-}
diff --git a/nuttx/lib/string/lib_strlen.c b/nuttx/lib/string/lib_strlen.c
deleted file mode 100644
index 833305809..000000000
--- a/nuttx/lib/string/lib_strlen.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strlen.c
- *
- * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-#ifndef CONFIG_ARCH_STRLEN
-size_t strlen(const char *s)
-{
- const char *sc;
- for (sc = s; *sc != '\0'; ++sc);
- return sc - s;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strncasecmp.c b/nuttx/lib/string/lib_strncasecmp.c
deleted file mode 100644
index be369cf0d..000000000
--- a/nuttx/lib/string/lib_strncasecmp.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strncasecmp.c
- *
- * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- *****************************************************************************/
-
-/****************************************************************************
- * Compilation Switches
- *****************************************************************************/
-
-/****************************************************************************
- * Included Files
- *****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <sys/types.h>
-#include <string.h>
-#include <ctype.h>
-
-/****************************************************************************
- * Global Functions
- *****************************************************************************/
-
-#ifndef CONFIG_ARCH_STRNCASECMP
-int strncasecmp(const char *cs, const char *ct, size_t nb)
-{
- int result = 0;
- for (; nb > 0; nb--)
- {
- if ((result = (int)toupper(*cs) - (int)toupper(*ct)) != 0 || !*cs)
- {
- break;
- }
-
- cs++;
- ct++;
- }
- return result;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strncat.c b/nuttx/lib/string/lib_strncat.c
deleted file mode 100644
index af893e0f9..000000000
--- a/nuttx/lib/string/lib_strncat.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/************************************************************
- * lib/string/lib_strncat.c
- *
- * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************/
-
-/************************************************************
- * Included Files
- ************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/************************************************************
- * Global Functions
- ************************************************************/
-
-#ifndef CONFIG_ARCH_STRNCAT
-char *strncat(char *dest, const char *src, size_t n)
-{
- char *ret = dest;
-
- dest += strlen(dest);
- for (; n > 0 && *src != '\0' ; n--)
- {
- *dest++ = *src++;
- }
- *dest = '\0';
-
- return ret;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strncmp.c b/nuttx/lib/string/lib_strncmp.c
deleted file mode 100644
index ce2282024..000000000
--- a/nuttx/lib/string/lib_strncmp.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- * lib/lib_strncmp.c
- *
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- *****************************************************************************/
-
-/****************************************************************************
- * Compilation Switches
- *****************************************************************************/
-
-/****************************************************************************
- * Included Files
- *****************************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- *****************************************************************************/
-
-#ifndef CONFIG_ARCH_STRNCMP
-int strncmp(const char *cs, const char *ct, size_t nb)
-{
- int result = 0;
- for (; nb > 0; nb--)
- {
- if ((result = (int)*cs - (int)*ct++) != 0 || !*cs++)
- {
- break;
- }
- }
- return result;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strncpy.c b/nuttx/lib/string/lib_strncpy.c
deleted file mode 100644
index 149369d50..000000000
--- a/nuttx/lib/string/lib_strncpy.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/************************************************************
- * lib/string/lib_strncpy.c
- *
- * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************/
-
-/************************************************************
- * Included Files
- ************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/************************************************************
- * Global Functions
- ************************************************************/
-
-#ifndef CONFIG_ARCH_STRNCPY
-char *strncpy(char *dest, const char *src, size_t n)
-{
- char *ret = dest; /* Value to be returned */
- char *end = dest + n; /* End of dest buffer + 1 byte */
-
- while ((*dest++ = *src++) != '\0' && dest != end);
- return ret;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strndup.c b/nuttx/lib/string/lib_strndup.c
deleted file mode 100644
index ffaf892ea..000000000
--- a/nuttx/lib/string/lib_strndup.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/************************************************************************
- * lib/string//lib_strndup.c
- *
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************/
-
-/************************************************************************
- * Included Files
- ************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-#include "lib_internal.h"
-
-/************************************************************************
- * Global Functions
- ************************************************************************/
-/************************************************************************
- * Name: strndup
- *
- * Description:
- * The strndup() function is equivalent to the strdup() function,
- * duplicating the provided 's' in a new block of memory allocated as
- * if by using malloc(), with the exception being that strndup() copies
- * at most 'size' plus one bytes into the newly allocated memory,
- * terminating the new string with a NUL character. If the length of 's'
- * is larger than 'size', only 'size' bytes will be duplicated. If
- * 'size' is larger than the length of 's', all bytes in s will be
- * copied into the new memory buffer, including the terminating NUL
- * character. The newly created string will always be properly
- * terminated.
- *
- ************************************************************************/
-
-FAR char *strndup(FAR const char *s, size_t size)
-{
- FAR char *news = NULL;
- if (s)
- {
- /* Get the size of the new string = MIN(strlen(s), size) */
-
- size_t allocsize = strlen(s);
- if (allocsize > size)
- {
- allocsize = size;
- }
-
- /* Allocate the new string, adding 1 for the NUL terminator */
-
- news = (FAR char*)lib_malloc(allocsize + 1);
- if (news)
- {
- /* Copy the string into the allocated memory and add a NUL
- * terminator in any case.
- */
-
- memcpy(news, s, allocsize);
- news[allocsize] = '\0';
- }
- }
- return news;
-}
diff --git a/nuttx/lib/string/lib_strnlen.c b/nuttx/lib/string/lib_strnlen.c
deleted file mode 100644
index 2b64fe984..000000000
--- a/nuttx/lib/string/lib_strnlen.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strnlen.c
- *
- * This file is part of NuttX, contributed by Michael Hrabanek
- *
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
- * Author: Michael Hrabanek
- *
- * Derives from the file lib/lib_strlen.c:
- *
- * Copyright (C) 2007, 2008, 2010 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-#ifndef CONFIG_ARCH_STRNLEN
-size_t strnlen(const char *s, size_t maxlen)
-{
- const char *sc;
- for (sc = s; maxlen != 0 && *sc != '\0'; maxlen--, ++sc);
- return sc - s;
-}
-#endif
diff --git a/nuttx/lib/string/lib_strpbrk.c b/nuttx/lib/string/lib_strpbrk.c
deleted file mode 100644
index 02e2ea2c7..000000000
--- a/nuttx/lib/string/lib_strpbrk.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strpbrk.c
- *
- * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use str source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions str binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer str
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-char *strpbrk(const char *str, const char *charset)
-{
- /* Sanity checking */
-
-#ifdef CONFIG_DEBUG
- if (!str || !charset)
- {
- return NULL;
- }
-#endif
-
- /* Check each character in the string */
-
- while (*str)
- {
- /* Check if the character from the string matches any character in the charset */
-
- if (strchr(charset, *str) != NULL)
- {
- /* Yes, then this position must be the first occurrence in string */
-
- return (char*)str;
- }
-
- /* This character from the strings matches none of those in the charset.
- * Try the next character from the string.
- */
-
- str++;
- }
-
- /* We have looked at every character in the string, and none of them match any of
- * the characters in charset.
- */
-
- return NULL;
-}
-
diff --git a/nuttx/lib/string/lib_strrchr.c b/nuttx/lib/string/lib_strrchr.c
deleted file mode 100644
index 91243ce58..000000000
--- a/nuttx/lib/string/lib_strrchr.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/************************************************************************
- * lib/string/lib_strrchr.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************/
-
-/************************************************************************
- * Included Files
- ************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-/************************************************************************
- * Global Functions
- ************************************************************************/
-
-/* The strrchr() function returns a pointer to the last
- * occurrence of the character c in the string s.
- */
-
-char *strrchr(const char *s, int c)
-{
- if (s)
- {
- const char *p = &s[strlen(s) - 1];
- for (; p >= s; p--)
- {
- if (*p == c)
- {
- return (char*)p;
- }
- }
- }
-
- return NULL;
-}
-
diff --git a/nuttx/lib/string/lib_strspn.c b/nuttx/lib/string/lib_strspn.c
deleted file mode 100644
index e7b5ea0a5..000000000
--- a/nuttx/lib/string/lib_strspn.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strspn.c
- *
- * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <sys/types.h>
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strspn
- *
- * Description:
- * strspn() calculates the length of the initial segment of s which
- * consists entirely of characters in accept.
- *
- ****************************************************************************/
-
-size_t strspn(const char *s, const char *accept)
-{
- size_t i;
- for (i = 0; s[i] && strchr(accept, s[i]) != NULL; i++);
- return i;
-}
diff --git a/nuttx/lib/string/lib_strstr.c b/nuttx/lib/string/lib_strstr.c
deleted file mode 100644
index b8c896fa2..000000000
--- a/nuttx/lib/string/lib_strstr.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strstr.c
- *
- * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use str source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions str binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer str
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-char *strstr(const char *str, const char *substr)
-{
- const char *candidate; /* Candidate in str with matching start character */
- char ch; /* First character of the substring */
- int len; /* The length of the substring */
-
- /* Special case the empty substring */
-
- len = strlen(substr);
- ch = *substr;
-
- if (!ch)
- {
- /* We'll say that an empty substring matches at the beginning of
- * the string
- */
-
- return (char*)str;
- }
-
- /* Search for the substring */
-
- candidate = str;
- for (;;)
- {
- /* strchr() will return a pointer to the next occurrence of the
- * character ch in the string
- */
-
- candidate = strchr(candidate, ch);
- if (!candidate || strlen(candidate) < len)
- {
- /* First character of the substring does not appear in the string
- * or the remainder of the string is not long enough to contain the
- * substring.
- */
-
- return NULL;
- }
-
- /* Check if this is the beginning of a matching substring */
-
- if (strncmp(candidate, substr, len) == 0)
- {
- return (char*)candidate;
- }
-
- /* No, find the next candidate after this one */
-
- candidate++;
- }
-
- /* Won't get here, but some compilers might complain */
-
- return NULL;
-}
-
diff --git a/nuttx/lib/string/lib_strtod.c b/nuttx/lib/string/lib_strtod.c
deleted file mode 100644
index 8fecd4571..000000000
--- a/nuttx/lib/string/lib_strtod.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strtod.c
- * Convert string to double
- *
- * Copyright (C) 2002 Michael Ringgaard. All rights reserved.
- * Copyright (C) 2006-2007 H. Peter Anvin.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/compiler.h>
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <errno.h>
-
-#ifdef CONFIG_HAVE_DOUBLE
-
-/****************************************************************************
- * Pre-processor definitions
- ****************************************************************************/
-
-/* These are predefined with GCC, but could be issues for other compilers. If
- * not defined, an arbitrary big number is put in for now. These should be
- * added to nuttx/compiler for your compiler.
- */
-
-#if !defined(__DBL_MIN_EXP__) || !defined(__DBL_MAX_EXP__)
-# ifdef CONFIG_CPP_HAVE_WARNING
-# warning "Size of exponent is unknown"
-# endif
-# undef __DBL_MIN_EXP__
-# define __DBL_MIN_EXP__ (-1021)
-# undef __DBL_MAX_EXP__
-# define __DBL_MAX_EXP__ (1024)
-#endif
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-static inline int is_real(double x)
-{
- const double_t infinite = 1.0/0.0;
- return (x < infinite) && (x >= -infinite);
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/***************************************************(************************
- * Name: strtod
- *
- * Description:
- * Convert a string to a double value
- *
- ****************************************************************************/
-
-double_t strtod(const char *str, char **endptr)
-{
- double_t number;
- int exponent;
- int negative;
- char *p = (char *) str;
- double p10;
- int n;
- int num_digits;
- int num_decimals;
- const double_t infinite = 1.0/0.0;
-
- /* Skip leading whitespace */
-
- while (isspace(*p))
- {
- p++;
- }
-
- /* Handle optional sign */
-
- negative = 0;
- switch (*p)
- {
- case '-':
- negative = 1; /* Fall through to increment position */
- case '+':
- p++;
- }
-
- number = 0.;
- exponent = 0;
- num_digits = 0;
- num_decimals = 0;
-
- /* Process string of digits */
-
- while (isdigit(*p))
- {
- number = number * 10. + (*p - '0');
- p++;
- num_digits++;
- }
-
- /* Process decimal part */
-
- if (*p == '.')
- {
- p++;
-
- while (isdigit(*p))
- {
- number = number * 10. + (*p - '0');
- p++;
- num_digits++;
- num_decimals++;
- }
-
- exponent -= num_decimals;
- }
-
- if (num_digits == 0)
- {
- set_errno(ERANGE);
- return 0.0;
- }
-
- /* Correct for sign */
-
- if (negative)
- {
- number = -number;
- }
-
- /* Process an exponent string */
-
- if (*p == 'e' || *p == 'E')
- {
- /* Handle optional sign */
-
- negative = 0;
- switch(*++p)
- {
- case '-':
- negative = 1; /* Fall through to increment pos */
- case '+':
- p++;
- }
-
- /* Process string of digits */
-
- n = 0;
- while (isdigit(*p))
- {
- n = n * 10 + (*p - '0');
- p++;
- }
-
- if (negative)
- {
- exponent -= n;
- }
- else
- {
- exponent += n;
- }
- }
-
- if (exponent < __DBL_MIN_EXP__ ||
- exponent > __DBL_MAX_EXP__)
- {
- set_errno(ERANGE);
- return infinite;
- }
-
- /* Scale the result */
-
- p10 = 10.;
- n = exponent;
- if (n < 0) n = -n;
- while (n)
- {
- if (n & 1)
- {
- if (exponent < 0)
- {
- number /= p10;
- }
- else
- {
- number *= p10;
- }
- }
- n >>= 1;
- p10 *= p10;
- }
-
- if (!is_real(number))
- {
- set_errno(ERANGE);
- }
-
- if (endptr)
- {
- *endptr = p;
- }
-
- return number;
-}
-
-#endif /* CONFIG_HAVE_DOUBLE */
-
diff --git a/nuttx/lib/string/lib_strtok.c b/nuttx/lib/string/lib_strtok.c
deleted file mode 100644
index c40993135..000000000
--- a/nuttx/lib/string/lib_strtok.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strtok.c
- *
- * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <string.h>
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static char *g_saveptr = NULL;
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtok
- *
- * Description:
- * The strtok() function parses a string into a
- * sequence of tokens. On the first call to strtok() the
- * string to be parsed should be specified in 'str'. In
- * each subsequent call that should parse the same string,
- * 'str' should be NULL.
- *
- * The 'delim' argument specifies a set of characters that
- * delimit the tokens in the parsed string. The caller
- * may specify different strings in delim in successive
- * calls that parse the same string.
- *
- * Each call to strtok() returns a pointer to a null-
- * terminated string containing the next token. This
- * string does not include the delimiting character. If
- * no more tokens are found, strtok() returns NULL.
- *
- * A sequence of two or more contiguous delimiter
- * characters in the parsed string is considered to be a
- * single delimiter. Delimiter characters at the start or
- * end of the string are ignored. The tokens returned by
- * strtok() are always non-empty strings.
- *
- * Return
- * strtok() returns a pointer to the next token, or NULL
- * if there are no more tokens.
- *
- ****************************************************************************/
-
-char *strtok(char *str, const char *delim)
-{
- return strtok_r(str, delim, &g_saveptr);
-}
diff --git a/nuttx/lib/string/lib_strtokr.c b/nuttx/lib/string/lib_strtokr.c
deleted file mode 100644
index 1c571b6ae..000000000
--- a/nuttx/lib/string/lib_strtokr.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strtokr.c
- *
- * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <string.h>
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtok_r
- *
- * Description:
- * The strtok_r() function is a reentrant version strtok().
- * Like strtok(), it parses a string into a sequence of
- * tokens. On the first call to strtok() the string to be
- * parsed should be specified in 'str'. In each subsequent
- * call that should parse the same string, 'str' should be
- * NULL.
- *
- * The 'saveptr' argument is a pointer to a char *
- * variable that is used internally by strtok_r() in
- * order to maintain context between successive calls
- * that parse the same string.
- *
- * On the first call to strtok_r(), 'str' should point to the
- * string to be parsed, and the value of 'saveptr' is
- * ignored. In subsequent calls, 'str' should be NULL, and
- * saveptr should be unchanged since the previous call.
- *
- * The 'delim' argument specifies a set of characters that
- * delimit the tokens in the parsed string. The caller
- * may specify different strings in delim in successive
- * calls that parse the same string.
- *
- * Each call to strtok_r() returns a pointer to a null-
- * terminated string containing the next token. This
- * string does not include the delimiting character. If
- * no more tokens are found, strtok_r() returns NULL.
- *
- * A sequence of two or more contiguous delimiter
- * characters in the parsed string is considered to be a
- * single delimiter. Delimiter characters at the start or
- * end of the string are ignored. The tokens returned by
- * strtok() are always non-empty strings.
- *
- * Return
- * strtok_r() returns a pointer to the next token, or NULL
- * if there are no more tokens.
- *
- ****************************************************************************/
-
-FAR char *strtok_r(FAR char *str, FAR const char *delim, FAR char **saveptr)
-{
- char *pbegin;
- char *pend = NULL;
-
- /* Decide if we are starting a new string or continuing from
- * the point we left off.
- */
-
- if (str)
- {
- pbegin = str;
- }
- else if (saveptr && *saveptr)
- {
- pbegin = *saveptr;
- }
- else
- {
- return NULL;
- }
-
- /* Find the beginning of the next token */
-
- for (;
- *pbegin && strchr(delim, *pbegin) != NULL;
- pbegin++);
-
- /* If we are at the end of the string with nothing
- * but delimiters found, then return NULL.
- */
-
- if (!*pbegin)
- {
- return NULL;
- }
-
- /* Find the end of the token */
-
- for (pend = pbegin + 1;
- *pend && strchr(delim, *pend) == NULL;
- pend++);
-
-
- /* pend either points to the end of the string or to
- * the first delimiter after the string.
- */
-
- if (*pend)
- {
- /* Turn the delimiter into a null terminator */
-
- *pend++ = '\0';
- }
-
- /* Save the pointer where we left off and return the
- * beginning of the token.
- */
-
- if (saveptr)
- {
- *saveptr = pend;
- }
- return pbegin;
-}
diff --git a/nuttx/lib/string/lib_strtol.c b/nuttx/lib/string/lib_strtol.c
deleted file mode 100644
index c17d87e63..000000000
--- a/nuttx/lib/string/lib_strtol.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strtol.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include "lib_internal.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtol
- *
- * Description:
- * The strtol() function converts the initial part of the string in
- * nptr to a long integer value according to the given base, which must be
- * between 2 and 36 inclusive, or be the special value 0.
- *
- * Warning: does not check for integer overflow!
- *
- ****************************************************************************/
-
-long strtol(const char *nptr, char **endptr, int base)
-{
- unsigned long accum = 0;
- bool negate = false;
-
- if (nptr)
- {
- /* Skip leading spaces */
-
- lib_skipspace(&nptr);
-
- /* Check for leading + or - */
-
- if (*nptr == '-')
- {
- negate = true;
- nptr++;
- }
- else if (*nptr == '+')
- {
- nptr++;
- }
-
- /* Get the unsigned value */
-
- accum = strtoul(nptr, endptr, base);
-
- /* Correct the sign of the result */
-
- if (negate)
- {
- return -(long)accum;
- }
- }
- return (long)accum;
-}
-
diff --git a/nuttx/lib/string/lib_strtoll.c b/nuttx/lib/string/lib_strtoll.c
deleted file mode 100644
index 242e025c0..000000000
--- a/nuttx/lib/string/lib_strtoll.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
- * lib/string/lib_strtoll.c
- *
- * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include "lib_internal.h"
-
-#ifdef CONFIG_HAVE_LONG_LONG
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtoll
- *
- * Description:
- * The strtol() function converts the initial part of the string in
- * nptr to a long long integer value according to the given base, which
- * must be between 2 and 36 inclusive, or be the special value 0.
- *
- * Warning: does not check for integer overflow!
- *
- ****************************************************************************/
-
-long long strtoll(const char *nptr, char **endptr, int base)
-{
- unsigned long long accum = 0;
- bool negate = false;
-
- if (nptr)
- {
- /* Skip leading spaces */
-
- lib_skipspace(&nptr);
-
- /* Check for leading + or - */
-
- if (*nptr == '-')
- {
- negate = true;
- nptr++;
- }
- else if (*nptr == '+')
- {
- nptr++;
- }
-
- /* Get the unsigned value */
-
- accum = strtoull(nptr, endptr, base);
-
- /* Correct the sign of the result */
-
- if (negate)
- {
- return -(long long)accum;
- }
- }
- return (long long)accum;
-}
-
-#endif
-
diff --git a/nuttx/lib/string/lib_strtoul.c b/nuttx/lib/string/lib_strtoul.c
deleted file mode 100644
index b0d2d090e..000000000
--- a/nuttx/lib/string/lib_strtoul.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
- * /lib/string/lib_strtoul.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdlib.h>
-
-#include "lib_internal.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtoul
- *
- * Description:
- * The strtol() function converts the initial part of the string in
- * nptr to a long unsigned integer value according to the given base, which
- * must be between 2 and 36 inclusive, or be the special value 0.
- *
- * Warning: does not check for integer overflow!
- *
- ****************************************************************************/
-
-unsigned long strtoul(const char *nptr, char **endptr, int base)
-{
- unsigned long accum = 0;
- int value;
-
- if (nptr)
- {
- /* Skip leading spaces */
-
- lib_skipspace(&nptr);
-
- /* Check for unspecified base */
-
- base = lib_checkbase(base, &nptr);
-
- /* Accumulate each "digit" */
-
- while (lib_isbasedigit(*nptr, base, &value))
- {
- accum = accum*base + value;
- nptr++;
- }
-
- /* Return the final pointer to the unused value */
-
- if (endptr)
- {
- *endptr = (char *)nptr;
- }
- }
- return accum;
-}
-
diff --git a/nuttx/lib/string/lib_strtoull.c b/nuttx/lib/string/lib_strtoull.c
deleted file mode 100644
index 6567457c0..000000000
--- a/nuttx/lib/string/lib_strtoull.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
- * /lib/string/lib_strtoull.c
- *
- * Copyright (C) 2009, 2010 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/compiler.h>
-
-#include <stdlib.h>
-
-#include "lib_internal.h"
-
-#ifdef CONFIG_HAVE_LONG_LONG
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtoull
- *
- * Description:
- * The strtol() function converts the initial part of the string in
- * nptr to a long unsigned integer value according to the given base, which
- * must be between 2 and 36 inclusive, or be the special value 0.
- *
- ****************************************************************************/
-
-unsigned long long strtoull(const char *nptr, char **endptr, int base)
-{
- unsigned long long accum = 0;
- int value;
-
- if (nptr)
- {
- /* Skip leading spaces */
-
- lib_skipspace(&nptr);
-
- /* Check for unspecified base */
-
- base = lib_checkbase(base, &nptr);
-
- /* Accumulate each "digit" */
-
- while (lib_isbasedigit(*nptr, base, &value))
- {
- accum = accum*base + value;
- nptr++;
- }
-
- /* Return the final pointer to the unused value */
-
- if (endptr)
- {
- *endptr = (char *)nptr;
- }
- }
- return accum;
-}
-#endif
-
diff --git a/nuttx/lib/string/lib_vikmemcpy.c b/nuttx/lib/string/lib_vikmemcpy.c
deleted file mode 100644
index b50942aaa..000000000
--- a/nuttx/lib/string/lib_vikmemcpy.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/****************************************************************************
- * File: lib/string/lib_vikmemcpy.c
- *
- * This is version of the optimized memcpy by Daniel Vik, adapted to the
- * NuttX environment.
- *
- * Copyright (C) 1999-2010 Daniel Vik
- *
- * Adaptations include:
- * - File name change
- * - Use of types defined in stdint.h
- * - Integration with the NuttX configuration system
- * - Other cosmetic changes for consistency with NuttX coding standards
- *
- * This software is provided 'as-is', without any express or implied
- * warranty. In no event will the authors be held liable for any
- * damages arising from the use of this software.
- * Permission is granted to anyone to use this software for any
- * purpose, including commercial applications, and to alter it and
- * redistribute it freely, subject to the following restrictions:
- *
- * 1. The origin of this software must not be misrepresented; you
- * must not claim that you wrote the original software. If you
- * use this software in a product, an acknowledgment in the
- * use this software in a product, an acknowledgment in the
- * product documentation would be appreciated but is not
- * required.
- *
- * 2. Altered source versions must be plainly marked as such, and
- * must not be misrepresented as being the original software.
- *
- * 3. This notice may not be removed or altered from any source
- * distribution.
- *
- * Description: Implementation of the standard library function memcpy.
- * This implementation of memcpy() is ANSI-C89 compatible.
- *
- * The following configuration options can be set:
- *
- * CONFIG_ENDIAN_BIG
- * Uses processor with big endian addressing. Default is little endian.
- *
- * CONFIG_MEMCPY_PRE_INC_PTRS
- * Use pre increment of pointers. Default is post increment of pointers.
- *
- * CONFIG_MEMCPY_INDEXED_COPY
- * Copying data using array indexing. Using this option, disables the
- * CONFIG_MEMCPY_PRE_INC_PTRS option.
- *
- * CONFIG_MEMCPY_64BIT - Compiles memcpy for 64 bit architectures
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Configuration definitions.
- ****************************************************************************/
-
-#define CONFIG_MEMCPY_INDEXED_COPY
-
-/********************************************************************
- * Included Files
- *******************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/compiler.h>
-
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-
-/********************************************************************
- * Pre-processor Definitions
- *******************************************************************/
-
-/* Can't support CONFIG_MEMCPY_64BIT if the platform does not have 64-bit
- * integer types.
- */
-
-#ifndef CONFIG_HAVE_LONG_LONG
-# undef CONFIG_MEMCPY_64BIT
-#endif
-
-/* Remove definitions when CONFIG_MEMCPY_INDEXED_COPY is defined */
-
-#if defined (CONFIG_MEMCPY_INDEXED_COPY)
-# if defined (CONFIG_MEMCPY_PRE_INC_PTRS)
-# undef CONFIG_MEMCPY_PRE_INC_PTRS
-# endif /* CONFIG_MEMCPY_PRE_INC_PTRS */
-#endif /* CONFIG_MEMCPY_INDEXED_COPY */
-
-/* Definitions for pre and post increment of pointers */
-
-#if defined (CONFIG_MEMCPY_PRE_INC_PTRS)
-
-# define START_VAL(x) (x)--
-# define INC_VAL(x) *++(x)
-# define CAST_TO_U8(p, o) ((uint8_t*)p + o + TYPE_WIDTH)
-# define WHILE_DEST_BREAK (TYPE_WIDTH - 1)
-# define PRE_LOOP_ADJUST - (TYPE_WIDTH - 1)
-# define PRE_SWITCH_ADJUST + 1
-
-#else /* CONFIG_MEMCPY_PRE_INC_PTRS */
-
-# define START_VAL(x)
-# define INC_VAL(x) *(x)++
-# define CAST_TO_U8(p, o) ((uint8_t*)p + o)
-# define WHILE_DEST_BREAK 0
-# define PRE_LOOP_ADJUST
-# define PRE_SWITCH_ADJUST
-
-#endif /* CONFIG_MEMCPY_PRE_INC_PTRS */
-
-/* Definitions for endian-ness */
-
-#ifdef CONFIG_ENDIAN_BIG
-
-# define SHL <<
-# define SHR >>
-
-#else /* CONFIG_ENDIAN_BIG */
-
-# define SHL >>
-# define SHR <<
-
-#endif /* CONFIG_ENDIAN_BIG */
-
-/********************************************************************
- * Macros for copying words of different alignment.
- * Uses incremening pointers.
- *******************************************************************/
-
-#define CP_INCR() \
-{ \
- INC_VAL(dstN) = INC_VAL(srcN); \
-}
-
-#define CP_INCR_SH(shl, shr) \
-{ \
- dstWord = srcWord SHL shl; \
- srcWord = INC_VAL(srcN); \
- dstWord |= srcWord SHR shr; \
- INC_VAL(dstN) = dstWord; \
-}
-
-/********************************************************************
- * Macros for copying words of different alignment.
- * Uses array indexes.
- *******************************************************************/
-
-#define CP_INDEX(idx) \
-{ \
- dstN[idx] = srcN[idx]; \
-}
-
-#define CP_INDEX_SH(x, shl, shr) \
-{ \
- dstWord = srcWord SHL shl; \
- srcWord = srcN[x]; \
- dstWord |= srcWord SHR shr; \
- dstN[x] = dstWord; \
-}
-
-/********************************************************************
- * Macros for copying words of different alignment.
- * Uses incremening pointers or array indexes depending on
- * configuration.
- *******************************************************************/
-
-#if defined (CONFIG_MEMCPY_INDEXED_COPY)
-
-# define CP(idx) CP_INDEX(idx)
-# define CP_SH(idx, shl, shr) CP_INDEX_SH(idx, shl, shr)
-
-# define INC_INDEX(p, o) ((p) += (o))
-
-#else /* CONFIG_MEMCPY_INDEXED_COPY */
-
-# define CP(idx) CP_INCR()
-# define CP_SH(idx, shl, shr) CP_INCR_SH(shl, shr)
-
-# define INC_INDEX(p, o)
-
-#endif /* CONFIG_MEMCPY_INDEXED_COPY */
-
-#define COPY_REMAINING(count) \
-{ \
- START_VAL(dst8); \
- START_VAL(src8); \
- \
- switch (count) \
- { \
- case 7: INC_VAL(dst8) = INC_VAL(src8); \
- case 6: INC_VAL(dst8) = INC_VAL(src8); \
- case 5: INC_VAL(dst8) = INC_VAL(src8); \
- case 4: INC_VAL(dst8) = INC_VAL(src8); \
- case 3: INC_VAL(dst8) = INC_VAL(src8); \
- case 2: INC_VAL(dst8) = INC_VAL(src8); \
- case 1: INC_VAL(dst8) = INC_VAL(src8); \
- case 0: \
- default: break; \
- } \
-}
-
-#define COPY_NO_SHIFT() \
-{ \
- UIntN* dstN = (UIntN*)(dst8 PRE_LOOP_ADJUST); \
- UIntN* srcN = (UIntN*)(src8 PRE_LOOP_ADJUST); \
- size_t length = count / TYPE_WIDTH; \
- \
- while (length & 7) \
- { \
- CP_INCR(); \
- length--; \
- } \
- \
- length /= 8; \
- \
- while (length--) \
- { \
- CP(0); \
- CP(1); \
- CP(2); \
- CP(3); \
- CP(4); \
- CP(5); \
- CP(6); \
- CP(7); \
- \
- INC_INDEX(dstN, 8); \
- INC_INDEX(srcN, 8); \
- } \
- \
- src8 = CAST_TO_U8(srcN, 0); \
- dst8 = CAST_TO_U8(dstN, 0); \
- \
- COPY_REMAINING(count & (TYPE_WIDTH - 1)); \
- \
- return dest; \
-}
-
-#define COPY_SHIFT(shift) \
-{ \
- UIntN* dstN = (UIntN*)((((UIntN)dst8) PRE_LOOP_ADJUST) & \
- ~(TYPE_WIDTH - 1)); \
- UIntN* srcN = (UIntN*)((((UIntN)src8) PRE_LOOP_ADJUST) & \
- ~(TYPE_WIDTH - 1)); \
- size_t length = count / TYPE_WIDTH; \
- UIntN srcWord = INC_VAL(srcN); \
- UIntN dstWord; \
- \
- while (length & 7) \
- { \
- CP_INCR_SH(8 * shift, 8 * (TYPE_WIDTH - shift)); \
- length--; \
- } \
- \
- length /= 8; \
- \
- while (length--) \
- { \
- CP_SH(0, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(1, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(2, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(3, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(4, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(5, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(6, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(7, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- \
- INC_INDEX(dstN, 8); \
- INC_INDEX(srcN, 8); \
- } \
- \
- src8 = CAST_TO_U8(srcN, (shift - TYPE_WIDTH)); \
- dst8 = CAST_TO_U8(dstN, 0); \
- \
- COPY_REMAINING(count & (TYPE_WIDTH - 1)); \
- \
- return dest; \
-}
-
-/********************************************************************
- * Type Definitions
- *******************************************************************/
-
-#ifdef CONFIG_MEMCPY_64BIT
-typedef uint64_t UIntN;
-# define TYPE_WIDTH 8L
-#else
-typedef uint32_t UIntN;
-# define TYPE_WIDTH 4L
-#endif
-
-/********************************************************************
- * Public Functions
- *******************************************************************/
-/********************************************************************
- * Name: memcpy
- *
- * Description:
- * Copies count bytes from src to dest. No overlap check is performed.
- *
- * Input Parameters:
- * dest - pointer to destination buffer
- * src - pointer to source buffer
- * count - number of bytes to copy
- *
- * Returned Value:
- * A pointer to destination buffer
- *
- *******************************************************************/
-
-void *memcpy(void *dest, const void *src, size_t count)
-{
- uint8_t *dst8 = (uint8_t*)dest;
- uint8_t *src8 = (uint8_t*)src;
-
- if (count < 8)
- {
- COPY_REMAINING(count);
- return dest;
- }
-
- START_VAL(dst8);
- START_VAL(src8);
-
- while (((UIntN)dst8 & (TYPE_WIDTH - 1)) != WHILE_DEST_BREAK)
- {
- INC_VAL(dst8) = INC_VAL(src8);
- count--;
- }
-
- switch ((((UIntN)src8) PRE_SWITCH_ADJUST) & (TYPE_WIDTH - 1))
- {
- case 0: COPY_NO_SHIFT(); break;
- case 1: COPY_SHIFT(1); break;
- case 2: COPY_SHIFT(2); break;
- case 3: COPY_SHIFT(3); break;
-#if TYPE_WIDTH > 4
- case 4: COPY_SHIFT(4); break;
- case 5: COPY_SHIFT(5); break;
- case 6: COPY_SHIFT(6); break;
- case 7: COPY_SHIFT(7); break;
-#endif
- }
-
- return dest;
-}