aboutsummaryrefslogtreecommitdiff
path: root/nuttx/libc/unistd
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/libc/unistd')
-rw-r--r--nuttx/libc/unistd/Make.defs53
-rw-r--r--nuttx/libc/unistd/lib_chdir.c179
-rw-r--r--nuttx/libc/unistd/lib_execl.c146
-rw-r--r--nuttx/libc/unistd/lib_execsymtab.c147
-rw-r--r--nuttx/libc/unistd/lib_execv.c151
-rw-r--r--nuttx/libc/unistd/lib_getcwd.c132
-rw-r--r--nuttx/libc/unistd/lib_getopt.c269
-rw-r--r--nuttx/libc/unistd/lib_getoptargp.c73
-rw-r--r--nuttx/libc/unistd/lib_getoptindp.c73
-rw-r--r--nuttx/libc/unistd/lib_getoptoptp.c73
10 files changed, 0 insertions, 1296 deletions
diff --git a/nuttx/libc/unistd/Make.defs b/nuttx/libc/unistd/Make.defs
deleted file mode 100644
index ee3ac0fc9..000000000
--- a/nuttx/libc/unistd/Make.defs
+++ /dev/null
@@ -1,53 +0,0 @@
-############################################################################
-# libc/unistd/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 unistd C files to the build
-
-CSRCS += lib_getopt.c lib_getoptargp.c lib_getoptindp.c lib_getoptoptp.c
-
-ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
-ifneq ($(CONFIG_DISABLE_ENVIRON),y)
-CSRCS += lib_chdir.c lib_getcwd.c
-endif
-
-ifeq ($(CONFIG_LIBC_EXECFUNCS),y)
-CSRCS += lib_execl.c lib_execv.c lib_execsymtab.c
-endif
-endif
-
-# Add the unistd directory to the build
-
-DEPPATH += --dep-path unistd
-VPATH += :unistd
diff --git a/nuttx/libc/unistd/lib_chdir.c b/nuttx/libc/unistd/lib_chdir.c
deleted file mode 100644
index 8953fb19b..000000000
--- a/nuttx/libc/unistd/lib_chdir.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
- * libc/unistd/lib_chdir.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 <sys/stat.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "lib_internal.h"
-
-#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
-
-/****************************************************************************
- * Public Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: _trimdir
- ****************************************************************************/
-
-#if 0
-static inline void _trimdir(char *path)
-{
- /* Skip any trailing '/' characters (unless it is also the leading '/') */
-
- int len = strlen(path) - 1;
- while (len > 0 && path[len] == '/')
- {
- path[len] = '\0';
- len--;
- }
-}
-#else
-# define _trimdir(p)
-#endif
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: chdir
- *
- * Description:
- * The chdir() function causes the directory named by the pathname pointed
- * to by the 'path' argument to become the current working directory; that
- * is, the starting point for path searches for pathnames not beginning
- * with '/'.
- *
- * Input Parmeters:
- * path - A pointer to a directory to use as the new current working
- * directory
- *
- * Returned Value:
- * 0(OK) on success; -1(ERROR) on failure with errno set appropriately:
- *
- * EACCES
- * Search permission is denied for any component of the pathname.
- * ELOOP
- * A loop exists in symbolic links encountered during resolution of the
- * 'path' argument OR more that SYMLOOP_MAX symbolic links in the
- * resolution of the 'path' argument.
- * ENAMETOOLONG
- * The length of the path argument exceeds PATH_MAX or a pathname component
- * is longer than NAME_MAX.
- * ENOENT
- * A component of 'path' does not name an existing directory or path is
- * an empty string.
- * ENOTDIR
- * A component of the pathname is not a directory.
- *
- ****************************************************************************/
-
-int chdir(FAR const char *path)
-{
- struct stat buf;
- char *oldpwd;
- char *alloc;
- int err;
- int ret;
-
- /* Verify the input parameters */
-
- if (!path)
- {
- err = ENOENT;
- goto errout;
- }
-
- /* Verify that 'path' refers to a directory */
-
- ret = stat(path, &buf);
- if (ret != 0)
- {
- err = ENOENT;
- goto errout;
- }
-
- /* Something exists here... is it a directory? */
-
- if (!S_ISDIR(buf.st_mode))
- {
- err = ENOTDIR;
- goto errout;
- }
-
- /* Yes, it is a directory. Remove any trailing '/' characters from the path */
-
- _trimdir(path);
-
- /* Replace any preceding OLDPWD with the current PWD (this is to
- * support 'cd -' in NSH)
- */
-
- sched_lock();
- oldpwd = getenv("PWD");
- if (!oldpwd)
- {
- oldpwd = CONFIG_LIB_HOMEDIR;
- }
-
- alloc = strdup(oldpwd); /* kludge needed because environment is realloc'ed */
- setenv("OLDPWD", alloc, TRUE);
- lib_free(alloc);
-
- /* Set the cwd to the input 'path' */
-
- setenv("PWD", path, TRUE);
- sched_unlock();
- return OK;
-
-errout:
- set_errno(err);
- return ERROR;
-}
-#endif /* CONFIG_NFILE_DESCRIPTORS && !CONFIG_DISABLE_ENVIRON */
diff --git a/nuttx/libc/unistd/lib_execl.c b/nuttx/libc/unistd/lib_execl.c
deleted file mode 100644
index fa50c1429..000000000
--- a/nuttx/libc/unistd/lib_execl.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
- * libc/unistd/lib_execl.c
- *
- * Copyright (C) 2013 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 <stdarg.h>
-#include <unistd.h>
-
-#ifdef CONFIG_LIBC_EXECFUNCS
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Global Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Private Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: execl
- *
- * Description:
- * The standard 'exec' family of functions will replace the current process
- * image with a new process image. The new image will be constructed from a
- * regular, executable file called the new process image file. There will
- * be no return from a successful exec, because the calling process image
- * is overlaid by the new process image.
- *
- * Simplified 'execl()' and 'execv()' functions are provided by NuttX for
- * compatibility. NuttX is a tiny embedded RTOS that does not support
- * processes and hence the concept of overlaying a tasks process image with
- * a new process image does not make any sense. In NuttX, these functions
- * are wrapper functions that:
- *
- * 1. Call the non-standard binfmt function 'exec', and then
- * 2. exit(0).
- *
- * Note the inefficiency when 'exec[l|v]()' is called in the normal, two-
- * step process: (1) first call vfork() to create a new thread, then (2)
- * call 'exec[l|v]()' to replace the new thread with a program from the
- * file system. Since the new thread will be terminated by the
- * 'exec[l|v]()' call, it really served no purpose other than to support
- * Unix compatility.
- *
- * The non-standard binfmt function 'exec()' needs to have (1) a symbol
- * table that provides the list of symbols exported by the base code, and
- * (2) the number of symbols in that table. This information is currently
- * provided to 'exec()' from 'exec[l|v]()' via NuttX configuration settings:
- *
- * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] support
- * CONFIG_EXECFUNCS_SYMTAB : Symbol table used by exec[l|v]
- * CONFIG_EXECFUNCS_NSYMBOLS : Number of symbols in the table
- *
- * As a result of the above, the current implementations of 'execl()' and
- * 'execv()' suffer from some incompatibilities that may or may not be
- * addressed in a future version of NuttX. Other than just being an
- * inefficient use of MCU resource, the most serious of these is that
- * the exec'ed task will not have the same task ID as the vfork'ed
- * function. So the parent function cannot know the ID of the exec'ed
- * task.
- *
- * Input Parameters:
- * path - The path to the program to be executed. If CONFIG_BINFMT_EXEPATH
- * is defined in the configuration, then this may be a relative path
- * from the current working directory. Otherwise, path must be the
- * absolute path to the program.
- * ... - A list of the string arguments to be recevied by the
- * program. Zero indicates the end of the list.
- *
- * Returned Value:
- * This function does not return on success. On failure, it will return
- * -1 (ERROR) and will set the 'errno' value appropriately.
- *
- ****************************************************************************/
-
-int execl(FAR const char *path, ...)
-{
- FAR char *argv[CONFIG_MAX_TASK_ARGS+1];
- va_list ap;
- int argc;
-
- /* Collect the arguments into the argv[] array */
-
- va_start(ap, path);
- for (argc = 0; argc < CONFIG_MAX_TASK_ARGS; argc++)
- {
- argv[argc] = va_arg(ap, FAR char *);
- if (argv[argc] == NULL)
- {
- break;
- }
- }
-
- argv[CONFIG_MAX_TASK_ARGS] = NULL;
- va_end(ap);
-
- /* Then let execv() do the real work */
-
- return execv(path, (char * const *)&argv);
-}
-
-#endif /* CONFIG_LIBC_EXECFUNCS */ \ No newline at end of file
diff --git a/nuttx/libc/unistd/lib_execsymtab.c b/nuttx/libc/unistd/lib_execsymtab.c
deleted file mode 100644
index 34b798bb4..000000000
--- a/nuttx/libc/unistd/lib_execsymtab.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
- * libc/unistd/lib_execsymtab.c
- *
- * Copyright (C) 2013 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 <assert.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/binfmt/symtab.h>
-
-#ifdef CONFIG_LIBC_EXECFUNCS
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-/* If CONFIG_LIBC_EXECFUNCS is defined in the configuration, then the
- * following must also be defined:
- */
-
-/* Symbol table used by exec[l|v] */
-
-#ifndef CONFIG_EXECFUNCS_SYMTAB
-# error "CONFIG_EXECFUNCS_SYMTAB must be defined"
-#endif
-
-/* Number of Symbols in the Table */
-
-#ifndef CONFIG_EXECFUNCS_NSYMBOLS
-# error "CONFIG_EXECFUNCS_NSYMBOLS must be defined"
-#endif
-
-/****************************************************************************
- * Public Variables
- ****************************************************************************/
-
-extern const struct symtab_s CONFIG_EXECFUNCS_SYMTAB;
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static FAR const struct symtab_s *g_exec_symtab = &CONFIG_EXECFUNCS_SYMTAB;
-static int g_exec_nsymbols = CONFIG_EXECFUNCS_NSYMBOLS;
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: exec_getsymtab
- *
- * Description:
- * Get the current symbol table selection as an atomic operation.
- *
- * Input Parameters:
- * symtab - The location to store the symbol table.
- * nsymbols - The location to store the number of symbols in the symbol table.
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols)
-{
- irqstate_t flags;
-
- DEBUGASSERT(symtab && nsymbols);
-
- /* Disable interrupts very briefly so that both the symbol table and its
- * size are returned as a single atomic operation.
- */
-
- flags = irqsave();
- *symtab = g_exec_symtab;
- *nsymbols = g_exec_nsymbols;
- irqrestore(flags);
-}
-
-/****************************************************************************
- * Name: exec_setsymtab
- *
- * Description:
- * Select a new symbol table selection as an atomic operation.
- *
- * Input Parameters:
- * symtab - The new symbol table.
- * nsymbols - The number of symbols in the symbol table.
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols)
-{
- irqstate_t flags;
-
- DEBUGASSERT(symtab);
-
- /* Disable interrupts very briefly so that both the symbol table and its
- * size are set as a single atomic operation.
- */
-
- flags = irqsave();
- g_exec_symtab = symtab;
- g_exec_nsymbols = nsymbols;
- irqrestore(flags);
-}
-
-#endif /* CONFIG_LIBC_EXECFUNCS */ \ No newline at end of file
diff --git a/nuttx/libc/unistd/lib_execv.c b/nuttx/libc/unistd/lib_execv.c
deleted file mode 100644
index 48b089913..000000000
--- a/nuttx/libc/unistd/lib_execv.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
- * libc/unistd/lib_execv.c
- *
- * Copyright (C) 2013 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 <unistd.h>
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/binfmt/binfmt.h>
-
-#ifdef CONFIG_LIBC_EXECFUNCS
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: execv
- *
- * Description:
- * The standard 'exec' family of functions will replace the current process
- * image with a new process image. The new image will be constructed from a
- * regular, executable file called the new process image file. There will
- * be no return from a successful exec, because the calling process image
- * is overlaid by the new process image.
- *
- * Simplified 'execl()' and 'execv()' functions are provided by NuttX for
- * compatibility. NuttX is a tiny embedded RTOS that does not support
- * processes and hence the concept of overlaying a tasks process image with
- * a new process image does not make any sense. In NuttX, these functions
- * are wrapper functions that:
- *
- * 1. Call the non-standard binfmt function 'exec', and then
- * 2. exit(0).
- *
- * Note the inefficiency when 'exec[l|v]()' is called in the normal, two-
- * step process: (1) first call vfork() to create a new thread, then (2)
- * call 'exec[l|v]()' to replace the new thread with a program from the
- * file system. Since the new thread will be terminated by the
- * 'exec[l|v]()' call, it really served no purpose other than to support
- * Unix compatility.
- *
- * The non-standard binfmt function 'exec()' needs to have (1) a symbol
- * table that provides the list of symbols exported by the base code, and
- * (2) the number of symbols in that table. This information is currently
- * provided to 'exec()' from 'exec[l|v]()' via NuttX configuration settings:
- *
- * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] support
- * CONFIG_EXECFUNCS_SYMTAB : Symbol table used by exec[l|v]
- * CONFIG_EXECFUNCS_NSYMBOLS : Number of symbols in the table
- *
- * As a result of the above, the current implementations of 'execl()' and
- * 'execv()' suffer from some incompatibilities that may or may not be
- * addressed in a future version of NuttX. Other than just being an
- * inefficient use of MCU resource, the most serious of these is that
- * the exec'ed task will not have the same task ID as the vfork'ed
- * function. So the parent function cannot know the ID of the exec'ed
- * task.
- *
- * Input Parameters:
- * path - The path to the program to be executed. If CONFIG_BINFMT_EXEPATH
- * is defined in the configuration, then this may be a relative path
- * from the current working directory. Otherwise, path must be the
- * absolute path to the program.
- * argv - A pointer to an array of string arguments. The end of the
- * array is indicated with a NULL entry.
- *
- * Returned Value:
- * This function does not return on success. On failure, it will return
- * -1 (ERROR) and will set the 'errno' value appropriately.
- *
- ****************************************************************************/
-
-int execv(FAR const char *path, FAR char *const argv[])
-{
- FAR const struct symtab_s *symtab;
- int nsymbols;
- int ret;
-
- /* Get the current symbol table selection */
-
- exec_getsymtab(&symtab, &nsymbols);
-
- /* Start the task */
-
- ret = exec(path, (FAR const char **)argv, symtab, nsymbols);
- if (ret < 0)
- {
- sdbg("exec failed: %d\n", errno);
- return ERROR;
- }
-
- /* Then exit */
-
- exit(0);
-
- /* We should not get here, but might be needed by some compilers. Other,
- * smarter compilers might complain that this code is unreachable. You just
- * can't win.
- */
-
- return ERROR;
-}
-
-#endif /* CONFIG_LIBC_EXECFUNCS */
diff --git a/nuttx/libc/unistd/lib_getcwd.c b/nuttx/libc/unistd/lib_getcwd.c
deleted file mode 100644
index 717ef2971..000000000
--- a/nuttx/libc/unistd/lib_getcwd.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
- * libc/unistd/lib_getcwd.c
- *
- * Copyright (C) 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 <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "lib_internal.h"
-
-#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
-
-/****************************************************************************
- * Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: getwcd
- *
- * Description:
- * getcwd() function places the absolute pathname of the current working
- * directory in the array pointed to by 'buf', and returns 'buf.' The
- * pathname copied to the array shall contain no components that are
- * symbolic links. The 'size' argument is the size in bytes of the
- * character array pointed to by the 'buf' argument.
- *
- * Input Parmeters:
- * buf - a pointer to the location in which the current working directory
- * pathaname is returned.
- * size - The size in bytes avaiable at 'buf'
- *
- * Returned Value:
- * Upon successful completion, getcwd() returns the 'buf' argument.
- * Otherwise, getcwd() returns a null pointer and sets errno to indicate
- * the error:
- *
- * EINVAL
- * The 'size' argument is 0 or the 'buf' argument is NULL.
- * ERANGE
- * The size argument is greater than 0, but is smaller than the length
- * of the currrent working directory pathname +1.
- * EACCES
- * Read or search permission was denied for a component of the pathname.
- * ENOMEM
- * Insufficient storage space is available.
- *
- ****************************************************************************/
-
-FAR char *getcwd(FAR char *buf, size_t size)
-{
- char *pwd;
-
- /* Verify input parameters */
-
-#ifdef CONFIG_DEBUG
- if (!buf || !size)
- {
- set_errno(EINVAL);
- return NULL;
- }
-#endif
-
- /* If no working directory is defined, then default to the home directory */
-
- pwd = getenv("PWD");
- if (!pwd)
- {
- pwd = CONFIG_LIB_HOMEDIR;
- }
-
- /* Verify that the cwd will fit into the user-provided buffer */
-
- if (strlen(pwd) + 1 > size)
- {
- set_errno(ERANGE);
- return NULL;
- }
-
- /* Copy the cwd to the user buffer */
-
- strcpy(buf, pwd);
- sched_unlock();
- return buf;
-}
-#endif /* CONFIG_NFILE_DESCRIPTORS && !CONFIG_DISABLE_ENVIRON */
diff --git a/nuttx/libc/unistd/lib_getopt.c b/nuttx/libc/unistd/lib_getopt.c
deleted file mode 100644
index 1a9190976..000000000
--- a/nuttx/libc/unistd/lib_getopt.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/****************************************************************************
- * libc/unistd/lib_getopt.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 <unistd.h>
-#include <string.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Global Variables
- ****************************************************************************/
-
-FAR char *optarg; /* Optional argument following option */
-int optind = 1; /* Index into argv */
-int optopt = '?'; /* unrecognized option character */
-
-/****************************************************************************
- * Private Variables
- ****************************************************************************/
-
-static FAR char *g_optptr = NULL;
-static bool g_binitialized = false;
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: getopt
- *
- * Description: getopt() parses command-line arguments. Its arguments argc
- * and argv are the argument count and array as passed to the main()
- * function on program invocation. An element of argv that starts with
- * '-' is an option element. The characters of this element (aside from
- * the initial '-') are option characters. If getopt() is called repeatedly,
- * it returns successively each of the option characters from each of the
- * option elements.
- *
- * If getopt() finds another option character, it returns that character,
- * updating the external variable optind and a static variable nextchar so
- * that the next call to getopt() can resume the scan with the following
- * option character or argv-element.
- *
- * If there are no more option characters, getopt() returns -1. Then optind
- * is the index in argv of the first argv-element that is not an option.
- *
- * The 'optstring' argument is a string containing the legitimate option
- * characters. If such a character is followed by a colon, this indicates
- * that the option requires an argument. If an argument is required for an
- * option so getopt() places a pointer to the following text in the same
- * argv-element, or the text of the following argv-element, in optarg.
- *
- * NOTES:
- * 1. opterr is not supported and this implementation of getopt() never
- * printfs error messages.
- * 2. getopt is NOT threadsafe!
- * 3. This version of getopt() does not reset global variables until
- * -1 is returned. As a result, your command line parsing loops
- * must call getopt() repeatedly and continue to parse if other
- * errors are returned ('?' or ':') until getopt() finally returns -1.
- * (You can also set optind to -1 to force a reset).
- *
- * Return: If an option was successfully found, then getopt() returns the
- * option character. If all command-line options have been parsed, then
- * getopt() returns -1. If getopt() encounters an option character that
- * was not in optstring, then '?' is returned. If getopt() encounters an
- * option with a missing argument, then the return value depends on the
- * first character in optstring: if it is ':', then ':' is returned;
- * otherwise '?' is returned.
- *
- ****************************************************************************/
-
-int getopt(int argc, FAR char *const argv[], FAR const char *optstring)
-{
- if (argv && optstring && argc > 1)
- {
- int noarg_ret = '?';
- char *optchar;
-
- /* The inital value of optind is 1. If getopt() is called again in the
- * program, optind must be reset to some value <= 1.
- */
-
- if (optind < 1 || !g_binitialized)
- {
- optind = 1; /* Skip over the program name */
- g_optptr = NULL; /* Start at the beginning of the first argument */
- g_binitialized = true; /* Now we are initialized */
- }
-
- /* If the first character of opstring s ':', then ':' is in the event of
- * a missing argument. Otherwise '?' is returned.
- */
-
- if (*optstring == ':')
- {
- noarg_ret = ':';
- optstring++;
- }
-
- /* Are we resuming in the middle, or at the end of a string of arguments?
- * g_optptr == NULL means that we are started at the beginning of argv[optind];
- * *g_optptr == \0 means that we are starting at the beginning of optind+1
- */
-
- while (!g_optptr || !*g_optptr)
- {
- /* We need to start at the beginning of the next argv. Check if we need
- * to increment optind
- */
-
- if (g_optptr)
- {
- /* Yes.. Increment it and check for the case where where we have
- * processed everything in the argv[] array.
- */
-
- optind++;
- }
-
- /* Check for the end of the argument list */
-
- g_optptr = argv[optind];
- if (!g_optptr)
- {
- /* There are no more arguments, we are finished */
-
- g_binitialized = false;
- return ERROR;
- }
-
- /* We are starting at the beginning of argv[optind]. In this case, the
- * first character must be '-'
- */
-
- if (*g_optptr != '-')
- {
- /* The argument does not start with '-', we are finished */
-
- g_binitialized = false;
- return ERROR;
- }
-
- /* Skip over the '-' */
-
- g_optptr++;
- }
-
- /* Special case handling of "-" and "-:" */
-
- if (!*g_optptr)
- {
- optopt = '\0'; /* We'll fix up g_optptr the next time we are called */
- return '?';
- }
-
- /* Handle the case of "-:" */
-
- if (*g_optptr == ':')
- {
- optopt = ':';
- g_optptr++;
- return '?';
- }
-
- /* g_optptr now points at the next option and it is not something crazy.
- * check if the option is in the list of valid options.
- */
-
- optchar = strchr(optstring, *g_optptr);
- if (!optchar)
- {
- /* No this character is not in the list of valid options */
-
- optopt = *g_optptr;
- g_optptr++;
- return '?';
- }
-
- /* Yes, the character is in the list of valid options. Does it have an
- * required argument?
- */
-
- if (optchar[1] != ':')
- {
- /* No, no arguments. Just return the character that we found */
-
- g_optptr++;
- return *optchar;
- }
-
- /* Yes, it has a required argument. Is the required argument
- * immediately after the command in this same argument?
- */
-
- if (g_optptr[1] != '\0')
- {
- /* Yes, return a pointer into the current argument */
-
- optarg = &g_optptr[1];
- optind++;
- g_optptr = NULL;
- return *optchar;
- }
-
- /* No.. is the optional argument the next argument in argv[] ? */
-
- if (argv[optind+1] && *argv[optind+1] != '-')
- {
- /* Yes.. return that */
-
- optarg = argv[optind+1];
- optind += 2;
- g_optptr = NULL;
- return *optchar;
- }
-
- /* No argument was supplied */
-
- optarg = NULL;
- optopt = *optchar;
- optind++;
- return noarg_ret;
- }
-
- g_binitialized = false;
- return ERROR;
-}
diff --git a/nuttx/libc/unistd/lib_getoptargp.c b/nuttx/libc/unistd/lib_getoptargp.c
deleted file mode 100644
index 5610342ca..000000000
--- a/nuttx/libc/unistd/lib_getoptargp.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
- * libc/unistd/lib_getoptargp.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 <unistd.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Global Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Private Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: getoptargp
- *
- * Description:
- * Returns a pointer to optarg. This function is only used for external
- * modules that need to access the base, global variable, optarg.
- *
- ****************************************************************************/
-
-FAR char **getoptargp(void)
-{
- return &optarg;
-}
-
diff --git a/nuttx/libc/unistd/lib_getoptindp.c b/nuttx/libc/unistd/lib_getoptindp.c
deleted file mode 100644
index 94ea4d3fc..000000000
--- a/nuttx/libc/unistd/lib_getoptindp.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
- * libc/unistd/lib_getoptindp.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 <unistd.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Global Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Private Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: getoptindp
- *
- * Description:
- * Returns a pointer to optind. This function is only used for external
- * modules that need to access the base, global variable, optind.
- *
- ****************************************************************************/
-
-int *getoptindp(void)
-{
- return &optind;
-}
-
diff --git a/nuttx/libc/unistd/lib_getoptoptp.c b/nuttx/libc/unistd/lib_getoptoptp.c
deleted file mode 100644
index cd99b172f..000000000
--- a/nuttx/libc/unistd/lib_getoptoptp.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
- * libc/unistd/lib_getoptoptp.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 <unistd.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Global Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Private Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Global Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: getoptoptp
- *
- * Description:
- * Returns a pointer to optopt. This function is only used for external
- * modules that need to access the base, global variable, optopt.
- *
- ****************************************************************************/
-
-int *getoptoptp(void)
-{
- return &optopt;
-}
-