Update documentation, change CONFIG_EXAMPLES_NSH to CONFIG_NSH
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3394 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
4923fdabc1
commit
a05c1d4bc2
@ -18,7 +18,7 @@ To execute an application function:
|
||||
NuttShell provides transparent method of invoking the command, when the
|
||||
following option is enabled:
|
||||
|
||||
CONFIG_EXAMPLES_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
|
||||
in the NuttX configuration.
|
||||
|
||||
|
@ -49,11 +49,11 @@ ASRCS =
|
||||
CSRCS = nsh_main.c nsh_fscmds.c nsh_ddcmd.c nsh_proccmds.c nsh_mmcmds.c \
|
||||
nsh_envcmds.c nsh_dbgcmds.c
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_NSH_BUILTIN_APPS),y)
|
||||
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
|
||||
CSRCS += nsh_apps.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_NSH_ROMFSETC),y)
|
||||
ifeq ($(CONFIG_NSH_ROMFSETC),y)
|
||||
CSRCS += nsh_romfsetc.c
|
||||
endif
|
||||
|
||||
@ -61,15 +61,15 @@ ifeq ($(CONFIG_NET),y)
|
||||
CSRCS += nsh_netinit.c nsh_netcmds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_NSH_CONSOLE),y)
|
||||
ifeq ($(CONFIG_NSH_CONSOLE),y)
|
||||
CSRCS += nsh_serial.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_NSH_TELNET),y)
|
||||
ifeq ($(CONFIG_NSH_TELNET),y)
|
||||
CSRCS += nsh_telnetd.c
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_EXAMPLES_NSH_DISABLESCRIPT),y)
|
||||
ifneq ($(CONFIG_NSH_DISABLESCRIPT),y)
|
||||
CSRCS += nsh_test.c
|
||||
endif
|
||||
|
||||
|
@ -100,7 +100,7 @@ NSH Start-Up Script
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
NSH supports options to provide a start up script for NSH. In general
|
||||
this capability is enabled with CONFIG_EXAMPLES_NSH_ROMFSETC, but has
|
||||
this capability is enabled with CONFIG_NSH_ROMFSETC, but has
|
||||
several other related configuration options as described in the final
|
||||
section of this README. This capability also depends on:
|
||||
|
||||
@ -116,7 +116,7 @@ for the use of Start-Up files. This paragraph will discuss the general
|
||||
behavior when all of the configuration options are set to the default
|
||||
values.
|
||||
|
||||
In this default case, enabling CONFIG_EXAMPLES_NSH_ROMFSETC will cause
|
||||
In this default case, enabling CONFIG_NSH_ROMFSETC will cause
|
||||
NSH to behave as follows at NSH startup time:
|
||||
|
||||
- NSH will create a read-only RAM disk (a ROM disk), containing a tiny
|
||||
@ -159,12 +159,12 @@ Modifying the ROMFS Image
|
||||
-------------------------
|
||||
|
||||
The contents of the /etc directory are retained in the file
|
||||
apps/nshlib/nsh_romfsimg.h (OR, if CONFIG_EXAMPLES_NSH_ARCHROMFS
|
||||
apps/nshlib/nsh_romfsimg.h (OR, if CONFIG_NSH_ARCHROMFS
|
||||
is defined, include/arch/board/rcs.template). In order to modify
|
||||
the start-up behavior, there are three things to study:
|
||||
|
||||
1. Configuration Options.
|
||||
The additional CONFIG_EXAMPLES_NSH_ROMFSETC configuration options
|
||||
The additional CONFIG_NSH_ROMFSETC configuration options
|
||||
discussed in the final section of this README.
|
||||
|
||||
2. tools/mkromfsimg.sh Script.
|
||||
@ -179,7 +179,7 @@ the start-up behavior, there are three things to study:
|
||||
- The configuration settings of the installed NuttX configuration.
|
||||
- The genromfs tool (available from http://romfs.sourceforge.net).
|
||||
- The file apps/nshlib/rcS.template (OR, if
|
||||
CONFIG_EXAMPLES_NSH_ARCHROMFS is defined, include/arch/board/rcs.template)
|
||||
CONFIG_NSH_ARCHROMFS is defined, include/arch/board/rcs.template)
|
||||
|
||||
3. rcS.template.
|
||||
The file apps/nshlib/rcS.template contains the general form
|
||||
@ -189,7 +189,7 @@ the start-up behavior, there are three things to study:
|
||||
NOTE:
|
||||
|
||||
apps/nshlib/rcS.template generates the standard, default
|
||||
nsh_romfsimg.h file. If CONFIG_EXAMPLES_NSH_ARCHROMFS is defined
|
||||
nsh_romfsimg.h file. If CONFIG_NSH_ARCHROMFS is defined
|
||||
in the NuttX configuration file, then a custom, board-specific
|
||||
nsh_romfsimg.h file residing in configs/<board>/include will be
|
||||
used. NOTE when the OS is configured, include/arch/board will
|
||||
@ -769,7 +769,7 @@ Command Dependencies on Configuration Settings
|
||||
|
||||
Command Depends on Configuration
|
||||
---------- --------------------------
|
||||
[ !CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
[ !CONFIG_NSH_DISABLESCRIPT
|
||||
cat CONFIG_NFILE_DESCRIPTORS > 0
|
||||
cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
cp CONFIG_NFILE_DESCRIPTORS > 0
|
||||
@ -797,9 +797,9 @@ Command Dependencies on Configuration Settings
|
||||
rm !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
|
||||
rmdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
|
||||
set !CONFIG_DISABLE_ENVIRON
|
||||
sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT
|
||||
sleep !CONFIG_DISABLE_SIGNALS
|
||||
test !CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
test !CONFIG_NSH_DISABLESCRIPT
|
||||
umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE
|
||||
unset !CONFIG_DISABLE_ENVIRON
|
||||
usleep !CONFIG_DISABLE_SIGNALS
|
||||
@ -821,19 +821,19 @@ In addition, each NSH command can be individually disabled via one of the follow
|
||||
settings. All of these settings make the configuration of NSH potentially complex but
|
||||
also allow it to squeeze into very small memory footprints.
|
||||
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_CAT, CONFIG_EXAMPLES_NSH_DISABLE_CD, CONFIG_EXAMPLES_NSH_DISABLE_CP,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_DD, CONFIG_EXAMPLES_NSH_DISABLE_ECHO, CONFIG_EXAMPLES_NSH_DISABLE_EXEC,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_EXIT, CONFIG_EXAMPLES_NSH_DISABLE_FREE, CONFIG_EXAMPLES_NSH_DISABLE_GET,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_HELP, CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG, CONFIG_EXAMPLES_NSH_DISABLE_KILL,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP, CONFIG_EXAMPLES_NSH_DISABLE_LS, CONFIG_EXAMPLES_NSH_DISABLE_MB,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_MKDIR, CONFIG_EXAMPLES_NSH_DISABLE_MKFATFS, CONFIG_EXAMPLES_NSH_DISABLE_MKFIFO,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_MKRD, CONFIG_EXAMPLES_NSH_DISABLE_MH, CONFIG_EXAMPLES_NSH_DISABLE_MOUNT,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_MW, CONFIG_EXAMPLES_NSH_DISABLE_PS, CONFIG_EXAMPLES_NSH_DISABLE_PING,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_PUT, CONFIG_EXAMPLES_NSH_DISABLE_PWD, CONFIG_EXAMPLES_NSH_DISABLE_RM,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_RMDIR, CONFIG_EXAMPLES_NSH_DISABLE_SET, CONFIG_EXAMPLES_NSH_DISABLE_SH,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_SLEEP, CONFIG_EXAMPLES_NSH_DISABLE_TEST, CONFIG_EXAMPLES_NSH_DISABLE_UMOUNT,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_UNSET, CONFIG_EXAMPLES_NSH_DISABLE_USLEEP, CONFIG_EXAMPLES_NSH_DISABLE_WGET,
|
||||
CONFIG_EXAMPLES_NSH_DISABLE_XD
|
||||
CONFIG_NSH_DISABLE_CAT, CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP,
|
||||
CONFIG_NSH_DISABLE_DD, CONFIG_NSH_DISABLE_ECHO, CONFIG_NSH_DISABLE_EXEC,
|
||||
CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE, CONFIG_NSH_DISABLE_GET,
|
||||
CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_IFCONFIG, CONFIG_NSH_DISABLE_KILL,
|
||||
CONFIG_NSH_DISABLE_LOSETUP, CONFIG_NSH_DISABLE_LS, CONFIG_NSH_DISABLE_MB,
|
||||
CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS, CONFIG_NSH_DISABLE_MKFIFO,
|
||||
CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH, CONFIG_NSH_DISABLE_MOUNT,
|
||||
CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING,
|
||||
CONFIG_NSH_DISABLE_PUT, CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM,
|
||||
CONFIG_NSH_DISABLE_RMDIR, CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH,
|
||||
CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT,
|
||||
CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET,
|
||||
CONFIG_NSH_DISABLE_XD
|
||||
|
||||
NSH-Specific Configuration Settings
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -841,70 +841,70 @@ NSH-Specific Configuration Settings
|
||||
The behavior of NSH can be modified with the following settings in
|
||||
the configs/<board-name>/defconfig file:
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_FILEIOSIZE
|
||||
* CONFIG_NSH_FILEIOSIZE
|
||||
Size of a static I/O buffer used for file access (ignored if
|
||||
there is no filesystem). Default is 1024.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_STRERROR
|
||||
* CONFIG_NSH_STRERROR
|
||||
strerror(errno) makes more readable output but strerror() is
|
||||
very large and will not be used unless this setting is 'y'
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_LINELEN
|
||||
* CONFIG_NSH_LINELEN
|
||||
The maximum length of one command line and of one output line.
|
||||
Default: 80
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_STACKSIZE
|
||||
* CONFIG_NSH_STACKSIZE
|
||||
The stack size to use when spawning new threads or tasks. Such
|
||||
new threads are generated when a command is executed in background
|
||||
or as new TELNET connections are established.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_NESTDEPTH
|
||||
* CONFIG_NSH_NESTDEPTH
|
||||
The maximum number of nested if-then[-else]-fi sequences that
|
||||
are permissable. Default: 3
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
* CONFIG_NSH_DISABLESCRIPT
|
||||
This can be set to 'y' to suppress support for scripting. This
|
||||
setting disables the 'sh', 'test', and '[' commands and the
|
||||
if-then[-else]-fi construct. This would only be set on systems
|
||||
where a minimal footprint is a necessity and scripting is not.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
* CONFIG_NSH_DISABLEBG
|
||||
This can be set to 'y' to suppress support for background
|
||||
commands. This setting disables the 'nice' command prefix and
|
||||
the '&' command suffix. This would only be set on systems
|
||||
where a minimal footprint is a necessity and background command
|
||||
execution is not.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_MMCSDMINOR
|
||||
* CONFIG_NSH_MMCSDMINOR
|
||||
If the architecture supports an MMC/SD slot and if the NSH
|
||||
architecture specific logic is present, this option will provide
|
||||
the MMC/SD minor number, i.e., the MMC/SD block driver will
|
||||
be registered as /dev/mmcsdN where N is the minor number.
|
||||
Default is zero.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_ROMFSETC
|
||||
* CONFIG_NSH_ROMFSETC
|
||||
Mount a ROMFS filesystem at /etc and provide a startup script
|
||||
at /etc/init.d/rcS. The default startup script will mount
|
||||
a FAT FS RAMDISK at /tmp but the logic is easily extensible.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_CONSOLE
|
||||
If CONFIG_EXAMPLES_NSH_CONSOLE is set to 'y', then a serial
|
||||
* CONFIG_NSH_CONSOLE
|
||||
If CONFIG_NSH_CONSOLE is set to 'y', then a serial
|
||||
console front-end is selected.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_TELNET
|
||||
If CONFIG_EXAMPLES_NSH_TELNET is set to 'y', then a TELENET
|
||||
* CONFIG_NSH_TELNET
|
||||
If CONFIG_NSH_TELNET is set to 'y', then a TELENET
|
||||
server front-end is selected. When this option is provided,
|
||||
you may log into NuttX remotely using telnet in order to
|
||||
access NSH.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_ARCHINIT
|
||||
* CONFIG_NSH_ARCHINIT
|
||||
Set if your board provides architecture specific initialization
|
||||
via the board-specific function nsh_archinitialize(). This
|
||||
function will be called early in NSH initialization to allow
|
||||
board logic to do such things as configure MMC/SD slots.
|
||||
|
||||
One or both of CONFIG_EXAMPLES_NSH_CONSOLE and CONFIG_EXAMPLES_NSH_TELNET
|
||||
must be defined. If CONFIG_EXAMPLES_NSH_TELNET is selected, then there some
|
||||
One or both of CONFIG_NSH_CONSOLE and CONFIG_NSH_TELNET
|
||||
must be defined. If CONFIG_NSH_TELNET is selected, then there some
|
||||
other configuration settings that apply:
|
||||
|
||||
* CONFIG_NET=y
|
||||
@ -917,24 +917,24 @@ NSH-Specific Configuration Settings
|
||||
TCP/IP support is required for telnet (as well as various other TCP-related
|
||||
configuration settings).
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE
|
||||
* CONFIG_NSH_IOBUFFER_SIZE
|
||||
Determines the size of the I/O buffer to use for sending/
|
||||
receiving TELNET commands/reponses
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_DHCPC
|
||||
* CONFIG_NSH_DHCPC
|
||||
Obtain the IP address via DHCP.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_IPADDR
|
||||
If CONFIG_EXAMPLES_NSH_DHCPC is NOT set, then the static IP
|
||||
* CONFIG_NSH_IPADDR
|
||||
If CONFIG_NSH_DHCPC is NOT set, then the static IP
|
||||
address must be provided.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_DRIPADDR
|
||||
* CONFIG_NSH_DRIPADDR
|
||||
Default router IP address
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_NETMASK
|
||||
* CONFIG_NSH_NETMASK
|
||||
Network mask
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_NOMAC
|
||||
* CONFIG_NSH_NOMAC
|
||||
Set if your ethernet hardware has no built-in MAC address.
|
||||
If set, a bogus MAC will be assigned.
|
||||
|
||||
@ -958,47 +958,47 @@ NSH-Specific Configuration Settings
|
||||
Per RFC2131 (p. 9), the DHCP client must be prepared to receive DHCP
|
||||
messages of up to 576 bytes (excluding Ethernet, IP, or UDP headers and FCS).
|
||||
|
||||
If CONFIG_EXAMPLES_NSH_ROMFSETC is selected, then the following additional
|
||||
If CONFIG_NSH_ROMFSETC is selected, then the following additional
|
||||
configuration setting apply:
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT
|
||||
* CONFIG_NSH_ROMFSMOUNTPT
|
||||
The default mountpoint for the ROMFS volume is /etc, but that
|
||||
can be changed with this setting. This must be a absolute path
|
||||
beginning with '/'.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_INITSCRIPT
|
||||
* CONFIG_NSH_INITSCRIPT
|
||||
This is the relative path to the startup script within the mountpoint.
|
||||
The default is init.d/rcS. This is a relative path and must not
|
||||
start with '/'.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_ROMFSDEVNO
|
||||
* CONFIG_NSH_ROMFSDEVNO
|
||||
This is the minor number of the ROMFS block device. The default is
|
||||
'0' corresponding to /dev/ram0.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE
|
||||
* CONFIG_NSH_ROMFSSECTSIZE
|
||||
This is the sector size to use with the ROMFS volume. Since the
|
||||
default volume is very small, this defaults to 64 but should be
|
||||
increased if the ROMFS volume were to be become large. Any value
|
||||
selected must be a power of 2.
|
||||
|
||||
When the default rcS file used when CONFIG_EXAMPLES_NSH_ROMFSETC is
|
||||
When the default rcS file used when CONFIG_NSH_ROMFSETC is
|
||||
selected, it will mount a FAT FS under /tmp. The following selections
|
||||
describe that FAT FS.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_FATDEVNO
|
||||
* CONFIG_NSH_FATDEVNO
|
||||
This is the minor number of the FAT FS block device. The default is
|
||||
'1' corresponding to /dev/ram1.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_FATSECTSIZE
|
||||
* CONFIG_NSH_FATSECTSIZE
|
||||
This is the sector size use with the FAT FS. Default is 512.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_FATNSECTORS
|
||||
* CONFIG_NSH_FATNSECTORS
|
||||
This is the number of sectors to use with the FAT FS. Defalt is
|
||||
1024. The amount of memory used by the FAT FS will be
|
||||
CONFIG_EXAMPLES_NSH_FATSECTSIZE * CONFIG_EXAMPLES_NSH_FATNSECTORS
|
||||
CONFIG_NSH_FATSECTSIZE * CONFIG_NSH_FATNSECTORS
|
||||
bytes.
|
||||
|
||||
* CONFIG_EXAMPLES_NSH_FATMOUNTPT
|
||||
* CONFIG_NSH_FATMOUNTPT
|
||||
This is the location where the FAT FS will be mounted. Default
|
||||
is /tmp.
|
||||
|
||||
|
172
nshlib/nsh.h
172
nshlib/nsh.h
@ -46,7 +46,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_CONSOLE
|
||||
#ifdef CONFIG_NSH_CONSOLE
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
@ -57,65 +57,65 @@
|
||||
/* The telnetd interface and background commands require pthread support */
|
||||
|
||||
#ifdef CONFIG_DISABLE_PTHREAD
|
||||
# undef CONFIG_EXAMPLES_NSH_TELNET
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
# define CONFIG_EXAMPLES_NSH_DISABLEBG 1
|
||||
# undef CONFIG_NSH_TELNET
|
||||
# ifndef CONFIG_NSH_DISABLEBG
|
||||
# define CONFIG_NSH_DISABLEBG 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Telnetd requires networking support */
|
||||
|
||||
#ifndef CONFIG_NET
|
||||
# undef CONFIG_EXAMPLES_NSH_TELNET
|
||||
# undef CONFIG_NSH_TELNET
|
||||
#endif
|
||||
|
||||
/* One front end must be defined */
|
||||
|
||||
#if !defined(CONFIG_EXAMPLES_NSH_CONSOLE) && !defined(CONFIG_EXAMPLES_NSH_TELNET)
|
||||
#if !defined(CONFIG_NSH_CONSOLE) && !defined(CONFIG_NSH_TELNET)
|
||||
# error "No NSH front end defined"
|
||||
#endif
|
||||
|
||||
/* Verify support for ROMFS /etc directory support options */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_ROMFSETC
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
# ifdef CONFIG_DISABLE_MOUNTPOINT
|
||||
# error "Mountpoint support is disabled"
|
||||
# undef CONFIG_EXAMPLES_NSH_ROMFSETC
|
||||
# undef CONFIG_NSH_ROMFSETC
|
||||
# endif
|
||||
# if CONFIG_NFILE_DESCRIPTORS < 4
|
||||
# error "Not enough file descriptors"
|
||||
# undef CONFIG_EXAMPLES_NSH_ROMFSETC
|
||||
# undef CONFIG_NSH_ROMFSETC
|
||||
# endif
|
||||
# ifndef CONFIG_FS_ROMFS
|
||||
# error "ROMFS support not enabled"
|
||||
# undef CONFIG_EXAMPLES_NSH_ROMFSETC
|
||||
# undef CONFIG_NSH_ROMFSETC
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT
|
||||
# define CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT "/etc"
|
||||
# ifndef CONFIG_NSH_ROMFSMOUNTPT
|
||||
# define CONFIG_NSH_ROMFSMOUNTPT "/etc"
|
||||
# endif
|
||||
# ifdef CONFIG_EXAMPLES_NSH_INIT
|
||||
# ifndef CONFIG_EXAMPLES_NSH_INITSCRIPT
|
||||
# define CONFIG_EXAMPLES_NSH_INITSCRIPT "init.d/rcS"
|
||||
# ifdef CONFIG_NSH_INIT
|
||||
# ifndef CONFIG_NSH_INITSCRIPT
|
||||
# define CONFIG_NSH_INITSCRIPT "init.d/rcS"
|
||||
# endif
|
||||
# endif
|
||||
# undef NSH_INITPATH
|
||||
# define NSH_INITPATH CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT "/" CONFIG_EXAMPLES_NSH_INITSCRIPT
|
||||
# ifndef CONFIG_EXAMPLES_NSH_ROMFSDEVNO
|
||||
# define CONFIG_EXAMPLES_NSH_ROMFSDEVNO 0
|
||||
# define NSH_INITPATH CONFIG_NSH_ROMFSMOUNTPT "/" CONFIG_NSH_INITSCRIPT
|
||||
# ifndef CONFIG_NSH_ROMFSDEVNO
|
||||
# define CONFIG_NSH_ROMFSDEVNO 0
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE
|
||||
# define CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE 64
|
||||
# ifndef CONFIG_NSH_ROMFSSECTSIZE
|
||||
# define CONFIG_NSH_ROMFSSECTSIZE 64
|
||||
# endif
|
||||
# define NSECTORS(b) (((b)+CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE-1)/CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE)
|
||||
# define NSECTORS(b) (((b)+CONFIG_NSH_ROMFSSECTSIZE-1)/CONFIG_NSH_ROMFSSECTSIZE)
|
||||
# define STR_RAMDEVNO(m) #m
|
||||
# define MKMOUNT_DEVNAME(m) "/dev/ram" STR_RAMDEVNO(m)
|
||||
# define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_EXAMPLES_NSH_ROMFSDEVNO)
|
||||
# define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_NSH_ROMFSDEVNO)
|
||||
#else
|
||||
# undef CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT
|
||||
# undef CONFIG_EXAMPLES_NSH_INIT
|
||||
# undef CONFIG_EXAMPLES_NSH_INITSCRIPT
|
||||
# undef CONFIG_EXAMPLES_NSH_ROMFSDEVNO
|
||||
# undef CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE
|
||||
# undef CONFIG_NSH_ROMFSMOUNTPT
|
||||
# undef CONFIG_NSH_INIT
|
||||
# undef CONFIG_NSH_INITSCRIPT
|
||||
# undef CONFIG_NSH_ROMFSDEVNO
|
||||
# undef CONFIG_NSH_ROMFSSECTSIZE
|
||||
#endif
|
||||
|
||||
/* This is the maximum number of arguments that will be accepted for a command */
|
||||
@ -123,10 +123,10 @@
|
||||
#define NSH_MAX_ARGUMENTS 6
|
||||
|
||||
/* strerror() produces much nicer output but is, however, quite large and
|
||||
* will only be used if CONFIG_EXAMPLES_NSH_STRERROR is defined.
|
||||
* will only be used if CONFIG_NSH_STRERROR is defined.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_STRERROR
|
||||
#ifdef CONFIG_NSH_STRERROR
|
||||
# define NSH_ERRNO strerror(errno)
|
||||
# define NSH_ERRNO_OF(err) strerror(err)
|
||||
#else
|
||||
@ -136,36 +136,36 @@
|
||||
|
||||
/* Maximum size of one command line (telnet or serial) */
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_LINELEN
|
||||
# define CONFIG_EXAMPLES_NSH_LINELEN 80
|
||||
#ifndef CONFIG_NSH_LINELEN
|
||||
# define CONFIG_NSH_LINELEN 80
|
||||
#endif
|
||||
|
||||
/* The following two settings are used only in the telnetd interface */
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE
|
||||
# define CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE 512
|
||||
#ifndef CONFIG_NSH_IOBUFFER_SIZE
|
||||
# define CONFIG_NSH_IOBUFFER_SIZE 512
|
||||
#endif
|
||||
|
||||
/* As threads are created to handle each request, a stack must be allocated
|
||||
* for the thread. Use a default if the user provided no stacksize.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_STACKSIZE
|
||||
# define CONFIG_EXAMPLES_NSH_STACKSIZE 4096
|
||||
#ifndef CONFIG_NSH_STACKSIZE
|
||||
# define CONFIG_NSH_STACKSIZE 4096
|
||||
#endif
|
||||
|
||||
/* The maximum number of nested if-then[-else]-fi sequences that
|
||||
* are permissable.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_NESTDEPTH
|
||||
# define CONFIG_EXAMPLES_NSH_NESTDEPTH 3
|
||||
#ifndef CONFIG_NSH_NESTDEPTH
|
||||
# define CONFIG_NSH_NESTDEPTH 3
|
||||
#endif
|
||||
|
||||
/* Define to enable dumping of all input/output buffers */
|
||||
|
||||
#undef CONFIG_EXAMPLES_NSH_TELNETD_DUMPBUFFER
|
||||
#undef CONFIG_EXAMPLES_NSH_FULLPATH
|
||||
#undef CONFIG_NSH_TELNETD_DUMPBUFFER
|
||||
#undef CONFIG_NSH_FULLPATH
|
||||
|
||||
/* Make sure that the home directory is defined */
|
||||
|
||||
@ -222,15 +222,15 @@ struct nsh_state_s
|
||||
|
||||
struct nsh_parser_s
|
||||
{
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
bool np_bg; /* true: The last command executed in background */
|
||||
#endif
|
||||
bool np_redirect; /* true: Output from the last command was re-directed */
|
||||
bool np_fail; /* true: The last command failed */
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
uint8_t np_ndx; /* Current index into np_st[] */
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
int np_nice; /* "nice" value applied to last background cmd */
|
||||
#endif
|
||||
|
||||
@ -238,8 +238,8 @@ struct nsh_parser_s
|
||||
* execution of commands that span multiple lines (like if-then-else-fi)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
struct nsh_state_s np_st[CONFIG_EXAMPLES_NSH_NESTDEPTH];
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
struct nsh_state_s np_st[CONFIG_NSH_NESTDEPTH];
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -251,7 +251,7 @@ struct nsh_vtbl_s
|
||||
* of the front end.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
FAR struct nsh_vtbl_s *(*clone)(FAR struct nsh_vtbl_s *vtbl);
|
||||
void (*addref)(FAR struct nsh_vtbl_s *vtbl);
|
||||
void (*release)(FAR struct nsh_vtbl_s *vtbl);
|
||||
@ -298,7 +298,7 @@ extern const char g_fmtsignalrecvd[];
|
||||
|
||||
/* Initialization */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_ROMFSETC
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
extern int nsh_romfsetc(void);
|
||||
#else
|
||||
# define nsh_romfsetc() (-ENOSYS)
|
||||
@ -310,13 +310,13 @@ extern int nsh_netinit(void);
|
||||
# define nsh_netinit() (-ENOSYS)
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_EXAMPLES_NSH_DISABLESCRIPT)
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
extern int nsh_script(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const char *path);
|
||||
#endif
|
||||
|
||||
/* Architecture-specific initialization */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_ARCHINIT
|
||||
#ifdef CONFIG_NSH_ARCHINIT
|
||||
extern int nsh_archinitialize(void);
|
||||
#else
|
||||
# define nsh_archinitialize() (-ENOSYS)
|
||||
@ -328,7 +328,7 @@ extern int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline);
|
||||
|
||||
/* Application interface */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS
|
||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||
extern int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
FAR char *argv[]);
|
||||
#endif
|
||||
@ -348,141 +348,141 @@ extern void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
|
||||
|
||||
/* Shell command handlers */
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_ECHO
|
||||
#ifndef CONFIG_NSH_DISABLE_ECHO
|
||||
extern int cmd_echo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_EXEC
|
||||
#ifndef CONFIG_NSH_DISABLE_EXEC
|
||||
extern int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MB
|
||||
#ifndef CONFIG_NSH_DISABLE_MB
|
||||
extern int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MH
|
||||
#ifndef CONFIG_NSH_DISABLE_MH
|
||||
extern int cmd_mh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MW
|
||||
#ifndef CONFIG_NSH_DISABLE_MW
|
||||
extern int cmd_mw(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_FREE
|
||||
#ifndef CONFIG_NSH_DISABLE_FREE
|
||||
extern int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_PS
|
||||
#ifndef CONFIG_NSH_DISABLE_PS
|
||||
extern int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_XD
|
||||
#ifndef CONFIG_NSH_DISABLE_XD
|
||||
extern int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_EXAMPLES_NSH_DISABLESCRIPT) && !defined(CONFIG_EXAMPLES_NSH_DISABLE_TEST)
|
||||
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
|
||||
extern int cmd_test(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
extern int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_CAT
|
||||
# ifndef CONFIG_NSH_DISABLE_CAT
|
||||
extern int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_CP
|
||||
# ifndef CONFIG_NSH_DISABLE_CP
|
||||
extern int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_DD
|
||||
# ifndef CONFIG_NSH_DISABLE_DD
|
||||
extern int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_LS
|
||||
# ifndef CONFIG_NSH_DISABLE_LS
|
||||
extern int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_EXAMPLES_NSH_DISABLESCRIPT)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_SH
|
||||
# if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
# ifndef CONFIG_NSH_DISABLE_SH
|
||||
extern int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# endif /* CONFIG_NFILE_STREAMS && !CONFIG_EXAMPLES_NSH_DISABLESCRIPT */
|
||||
# endif /* CONFIG_NFILE_STREAMS && !CONFIG_NSH_DISABLESCRIPT */
|
||||
# ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP
|
||||
# ifndef CONFIG_NSH_DISABLE_LOSETUP
|
||||
extern int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKFIFO
|
||||
# ifndef CONFIG_NSH_DISABLE_MKFIFO
|
||||
extern int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifdef CONFIG_FS_READABLE
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MOUNT
|
||||
# ifndef CONFIG_NSH_DISABLE_MOUNT
|
||||
extern int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_UMOUNT
|
||||
# ifndef CONFIG_NSH_DISABLE_UMOUNT
|
||||
extern int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifdef CONFIG_FS_WRITABLE
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKDIR
|
||||
# ifndef CONFIG_NSH_DISABLE_MKDIR
|
||||
extern int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKRD
|
||||
# ifndef CONFIG_NSH_DISABLE_MKRD
|
||||
extern int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_RM
|
||||
# ifndef CONFIG_NSH_DISABLE_RM
|
||||
extern int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_RMDIR
|
||||
# ifndef CONFIG_NSH_DISABLE_RMDIR
|
||||
extern int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# endif /* CONFIG_FS_WRITABLE */
|
||||
# endif /* CONFIG_FS_READABLE */
|
||||
# ifdef CONFIG_FS_FAT
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKFATFS
|
||||
# ifndef CONFIG_NSH_DISABLE_MKFATFS
|
||||
extern int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# endif /* CONFIG_FS_FAT */
|
||||
# endif /* !CONFIG_DISABLE_MOUNTPOINT */
|
||||
# if !defined(CONFIG_DISABLE_ENVIRON)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_CD
|
||||
# ifndef CONFIG_NSH_DISABLE_CD
|
||||
extern int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_PWD
|
||||
# ifndef CONFIG_NSH_DISABLE_PWD
|
||||
extern int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# endif /* !CONFIG_DISABLE_MOUNTPOINT */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
#if defined(CONFIG_NET)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG
|
||||
# ifndef CONFIG_NSH_DISABLE_IFCONFIG
|
||||
extern int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_GET
|
||||
# ifndef CONFIG_NSH_DISABLE_GET
|
||||
extern int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_PUT
|
||||
# ifndef CONFIG_NSH_DISABLE_PUT
|
||||
extern int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#endif
|
||||
#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_WGET
|
||||
# ifndef CONFIG_NSH_DISABLE_WGET
|
||||
extern int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#endif
|
||||
#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) && \
|
||||
!defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_DISABLE_SIGNALS)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_PING
|
||||
# ifndef CONFIG_NSH_DISABLE_PING
|
||||
extern int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_SET
|
||||
# ifndef CONFIG_NSH_DISABLE_SET
|
||||
extern int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_UNSET
|
||||
# ifndef CONFIG_NSH_DISABLE_UNSET
|
||||
extern int cmd_unset(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#endif /* CONFIG_DISABLE_ENVIRON */
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_KILL
|
||||
# ifndef CONFIG_NSH_DISABLE_KILL
|
||||
extern int cmd_kill(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_SLEEP
|
||||
# ifndef CONFIG_NSH_DISABLE_SLEEP
|
||||
extern int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_USLEEP
|
||||
# ifndef CONFIG_NSH_DISABLE_USLEEP
|
||||
extern int cmd_usleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#endif /* CONFIG_DISABLE_SIGNALS */
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
#include "nsh.h"
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS
|
||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -127,6 +127,6 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_EXAMPLES_NSH_BUILTIN_APPS */
|
||||
#endif /* CONFIG_NSH_BUILTIN_APPS */
|
||||
|
||||
|
||||
|
@ -137,7 +137,7 @@ int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
|
||||
* Name: cmd_mb
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MB
|
||||
#ifndef CONFIG_NSH_DISABLE_MB
|
||||
int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
struct dbgmem_s mem;
|
||||
@ -190,7 +190,7 @@ int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_mh
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MH
|
||||
#ifndef CONFIG_NSH_DISABLE_MH
|
||||
int cmd_mh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
struct dbgmem_s mem;
|
||||
@ -243,7 +243,7 @@ int cmd_mh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_mw
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MW
|
||||
#ifndef CONFIG_NSH_DISABLE_MW
|
||||
int cmd_mw(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
struct dbgmem_s mem;
|
||||
@ -329,7 +329,7 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
|
||||
* Name: cmd_xd
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_XD
|
||||
#ifndef CONFIG_NSH_DISABLE_XD
|
||||
int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *addr;
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include <nuttx/fs.h>
|
||||
#include "nsh.h"
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_EXAMPLES_NSH_DISABLE_DD)
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_NSH_DISABLE_DD)
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -492,7 +492,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
|
||||
#ifdef CAN_PIPE_FROM_STD
|
||||
DD_INFD = 0; /* stdin */
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_DD
|
||||
#ifndef CONFIG_NSH_DISABLE_DD
|
||||
dd.infread = readch; /* Character oriented read */
|
||||
dd.infclose = noclose; /* Don't close stdin */
|
||||
#endif
|
||||
@ -503,7 +503,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
|
||||
#ifdef CAN_PIPE_FROM_STD
|
||||
DD_OUTDF = 1; /* stdout */
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_DD
|
||||
#ifndef CONFIG_NSH_DISABLE_DD
|
||||
dd.outfwrite = writech; /* Character oriented write */
|
||||
dd.outfclose = noclose; /* Don't close stdout */
|
||||
#endif
|
||||
@ -637,5 +637,5 @@ errout_with_paths:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS && !CONFIG_EXAMPLES_NSH_DISABLE_DD */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS && !CONFIG_NSH_DISABLE_DD */
|
||||
|
||||
|
@ -208,7 +208,7 @@ void nsh_freefullpath(char *relpath)
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_CD
|
||||
#ifndef CONFIG_NSH_DISABLE_CD
|
||||
int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
const char *path = argv[1];
|
||||
@ -266,7 +266,7 @@ int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_echo
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_ECHO
|
||||
#ifndef CONFIG_NSH_DISABLE_ECHO
|
||||
int cmd_echo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
@ -289,7 +289,7 @@ int cmd_echo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_PWD
|
||||
#ifndef CONFIG_NSH_DISABLE_PWD
|
||||
int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
nsh_output(vtbl, "%s\n", nsh_getcwd());
|
||||
@ -303,7 +303,7 @@ int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_SET
|
||||
#ifndef CONFIG_NSH_DISABLE_SET
|
||||
int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
int ret = setenv(argv[1], argv[2], TRUE);
|
||||
@ -321,7 +321,7 @@ int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_UNSET
|
||||
#ifndef CONFIG_NSH_DISABLE_UNSET
|
||||
int cmd_unset(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
int ret = unsetenv(argv[1]);
|
||||
|
@ -83,9 +83,9 @@
|
||||
*/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifdef CONFIG_EXAMPLES_NSH_FILEIOSIZE
|
||||
# if CONFIG_EXAMPLES_NSH_FILEIOSIZE > (PATH_MAX + 1)
|
||||
# define IOBUFFERSIZE CONFIG_EXAMPLES_NSH_FILEIOSIZE
|
||||
# ifdef CONFIG_NSH_FILEIOSIZE
|
||||
# if CONFIG_NSH_FILEIOSIZE > (PATH_MAX + 1)
|
||||
# define IOBUFFERSIZE CONFIG_NSH_FILEIOSIZE
|
||||
# else
|
||||
# define IOBUFFERSIZE (PATH_MAX + 1)
|
||||
# endif
|
||||
@ -176,7 +176,7 @@ static int foreach_direntry(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const
|
||||
|
||||
/* Trim trailing '/' from directory names */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_FULLPATH
|
||||
#ifdef CONFIG_NSH_FULLPATH
|
||||
trim_dir(arg);
|
||||
#endif
|
||||
|
||||
@ -330,7 +330,7 @@ static int ls_handler(FAR struct nsh_vtbl_s *vtbl, const char *dirpath, struct d
|
||||
|
||||
/* then provide the filename that is common to normal and verbose output */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_FULLPATH
|
||||
#ifdef CONFIG_NSH_FULLPATH
|
||||
nsh_output(vtbl, " %s/%s", arg, entryp->d_name);
|
||||
#else
|
||||
nsh_output(vtbl, " %s", entryp->d_name);
|
||||
@ -395,7 +395,7 @@ static int ls_recursive(FAR struct nsh_vtbl_s *vtbl, const char *dirpath,
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_CAT
|
||||
#ifndef CONFIG_NSH_DISABLE_CAT
|
||||
int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char buffer[IOBUFFERSIZE];
|
||||
@ -508,7 +508,7 @@ int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_CP
|
||||
#ifndef CONFIG_NSH_DISABLE_CP
|
||||
int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
struct stat buf;
|
||||
@ -690,7 +690,7 @@ errout:
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP
|
||||
#ifndef CONFIG_NSH_DISABLE_LOSETUP
|
||||
int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *loopdev = NULL;
|
||||
@ -821,7 +821,7 @@ errout_with_paths:
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_LS
|
||||
#ifndef CONFIG_NSH_DISABLE_LS
|
||||
int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
const char *relpath;
|
||||
@ -914,7 +914,7 @@ int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKDIR
|
||||
#ifndef CONFIG_NSH_DISABLE_MKDIR
|
||||
int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *fullpath = nsh_getfullpath(vtbl, argv[1]);
|
||||
@ -939,7 +939,7 @@ int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_FAT)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKFATFS
|
||||
#ifndef CONFIG_NSH_DISABLE_MKFATFS
|
||||
int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
struct fat_format_s fmt = FAT_FORMAT_INITIALIZER;
|
||||
@ -965,7 +965,7 @@ int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKFIFO
|
||||
#ifndef CONFIG_NSH_DISABLE_MKFIFO
|
||||
int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *fullpath = nsh_getfullpath(vtbl, argv[1]);
|
||||
@ -990,7 +990,7 @@ int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKRD
|
||||
#ifndef CONFIG_NSH_DISABLE_MKRD
|
||||
int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
const char *fmt;
|
||||
@ -1100,7 +1100,7 @@ errout_with_fmt:
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MOUNT
|
||||
#ifndef CONFIG_NSH_DISABLE_MOUNT
|
||||
int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *source;
|
||||
@ -1190,7 +1190,7 @@ int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_RM
|
||||
#ifndef CONFIG_NSH_DISABLE_RM
|
||||
int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *fullpath = nsh_getfullpath(vtbl, argv[1]);
|
||||
@ -1215,7 +1215,7 @@ int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_RMDIR
|
||||
#ifndef CONFIG_NSH_DISABLE_RMDIR
|
||||
int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *fullpath = nsh_getfullpath(vtbl, argv[1]);
|
||||
@ -1239,7 +1239,7 @@ int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: nsh_script
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_EXAMPLES_NSH_DISABLESCRIPT)
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
int nsh_script(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const char *path)
|
||||
{
|
||||
char *fullpath;
|
||||
@ -1280,7 +1280,7 @@ int nsh_script(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const char *path)
|
||||
/* Get the next line of input from the file*/
|
||||
|
||||
fflush(stdout);
|
||||
pret = fgets(buffer, CONFIG_EXAMPLES_NSH_LINELEN, stream);
|
||||
pret = fgets(buffer, CONFIG_NSH_LINELEN, stream);
|
||||
if (pret)
|
||||
{
|
||||
/* Parse process the command. NOTE: this is recursive...
|
||||
@ -1304,8 +1304,8 @@ int nsh_script(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const char *path)
|
||||
* Name: cmd_sh
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_EXAMPLES_NSH_DISABLESCRIPT)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_SH
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
#ifndef CONFIG_NSH_DISABLE_SH
|
||||
int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
return nsh_script(vtbl, argv[0], argv[1]);
|
||||
@ -1318,7 +1318,7 @@ int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_UMOUNT
|
||||
#ifndef CONFIG_NSH_DISABLE_UMOUNT
|
||||
int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *fullpath = nsh_getfullpath(vtbl, argv[1]);
|
||||
|
@ -52,11 +52,11 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS
|
||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||
# include <apps/apps.h>
|
||||
#endif
|
||||
#include <apps/nsh.h>
|
||||
@ -79,7 +79,7 @@
|
||||
* Maximum size is NSH_MAX_ARGUMENTS+5
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+5)
|
||||
#else
|
||||
# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+4)
|
||||
@ -98,7 +98,7 @@ struct cmdmap_s
|
||||
const char *usage; /* Usage instructions for 'help' command */
|
||||
};
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
struct cmdarg_s
|
||||
{
|
||||
FAR struct nsh_vtbl_s *vtbl; /* For front-end interaction */
|
||||
@ -112,11 +112,11 @@ struct cmdarg_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_HELP
|
||||
#ifndef CONFIG_NSH_DISABLE_HELP
|
||||
static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_EXIT
|
||||
#ifndef CONFIG_NSH_DISABLE_EXIT
|
||||
static int cmd_exit(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
static int cmd_unrecognized(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
@ -134,31 +134,31 @@ static const char g_failure[] = "1";
|
||||
|
||||
static const struct cmdmap_s g_cmdmap[] =
|
||||
{
|
||||
#if !defined(CONFIG_EXAMPLES_NSH_DISABLESCRIPT) && !defined(CONFIG_EXAMPLES_NSH_DISABLE_TEST)
|
||||
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
|
||||
{ "[", cmd_lbracket, 4, NSH_MAX_ARGUMENTS, "<expression> ]" },
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_CAT
|
||||
# ifndef CONFIG_NSH_DISABLE_CAT
|
||||
{ "cat", cmd_cat, 2, NSH_MAX_ARGUMENTS, "<path> [<path> [<path> ...]]" },
|
||||
# endif
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_CD
|
||||
# ifndef CONFIG_NSH_DISABLE_CD
|
||||
{ "cd", cmd_cd, 1, 2, "[<dir-path>|-|~|..]" },
|
||||
# endif
|
||||
#endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_CP
|
||||
# ifndef CONFIG_NSH_DISABLE_CP
|
||||
{ "cp", cmd_cp, 3, 3, "<source-path> <dest-path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_LS
|
||||
# ifndef CONFIG_NSH_DISABLE_LS
|
||||
{ "dd", cmd_dd, 3, 6, "if=<infile> of=<outfile> [bs=<sectsize>] [count=<sectors>] [skip=<sectors>]" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_ECHO
|
||||
#ifndef CONFIG_NSH_DISABLE_ECHO
|
||||
# ifndef CONFIG_DISABLE_ENVIRON
|
||||
{ "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string|$name> [<string|$name>...]]" },
|
||||
# else
|
||||
@ -166,172 +166,172 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_EXEC
|
||||
#ifndef CONFIG_NSH_DISABLE_EXEC
|
||||
{ "exec", cmd_exec, 2, 3, "<hex-address>" },
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_EXIT
|
||||
#ifndef CONFIG_NSH_DISABLE_EXIT
|
||||
{ "exit", cmd_exit, 1, 1, NULL },
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_FREE
|
||||
#ifndef CONFIG_NSH_DISABLE_FREE
|
||||
{ "free", cmd_free, 1, 1, NULL },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_GET
|
||||
# ifndef CONFIG_NSH_DISABLE_GET
|
||||
{ "get", cmd_get, 4, 7, "[-b|-n] [-f <local-path>] -h <ip-address> <remote-path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_HELP
|
||||
#ifndef CONFIG_NSH_DISABLE_HELP
|
||||
{ "help", cmd_help, 1, 1, NULL },
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG
|
||||
# ifndef CONFIG_NSH_DISABLE_IFCONFIG
|
||||
{ "ifconfig", cmd_ifconfig, 1, 1, NULL },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_SLEEP
|
||||
# ifndef CONFIG_NSH_DISABLE_SLEEP
|
||||
{ "kill", cmd_kill, 3, 3, "-<signal> <pid>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP
|
||||
# ifndef CONFIG_NSH_DISABLE_LOSETUP
|
||||
{ "losetup", cmd_losetup, 3, 6, "[-d <dev-path>] | [[-o <offset>] [-r] <dev-path> <file-path>]" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_LS
|
||||
# ifndef CONFIG_NSH_DISABLE_LS
|
||||
{ "ls", cmd_ls, 1, 5, "[-lRs] <dir-path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MB
|
||||
#ifndef CONFIG_NSH_DISABLE_MB
|
||||
{ "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKDIR
|
||||
# ifndef CONFIG_NSH_DISABLE_MKDIR
|
||||
{ "mkdir", cmd_mkdir, 2, 2, "<path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_FAT)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKFATFS
|
||||
# ifndef CONFIG_NSH_DISABLE_MKFATFS
|
||||
{ "mkfatfs", cmd_mkfatfs, 2, 2, "<path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKFIFO
|
||||
# ifndef CONFIG_NSH_DISABLE_MKFIFO
|
||||
{ "mkfifo", cmd_mkfifo, 2, 2, "<path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKRD
|
||||
# ifndef CONFIG_NSH_DISABLE_MKRD
|
||||
{ "mkrd", cmd_mkrd, 2, 6, "[-m <minor>] [-s <sector-size>] <nsectors>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MH
|
||||
#ifndef CONFIG_NSH_DISABLE_MH
|
||||
{ "mh", cmd_mh, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_MOUNT
|
||||
# ifndef CONFIG_NSH_DISABLE_MOUNT
|
||||
{ "mount", cmd_mount, 4, 5, "-t <fstype> <block-device> <dir-path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MW
|
||||
#ifndef CONFIG_NSH_DISABLE_MW
|
||||
{ "mw", cmd_mw, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET) && defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) && \
|
||||
!defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_DISABLE_SIGNALS)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_PING
|
||||
# ifndef CONFIG_NSH_DISABLE_PING
|
||||
{ "ping", cmd_ping, 2, 6, "[-c <count>] [-i <interval>] <ip-address>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_PS
|
||||
#ifndef CONFIG_NSH_DISABLE_PS
|
||||
{ "ps", cmd_ps, 1, 1, NULL },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_PUT
|
||||
# ifndef CONFIG_NSH_DISABLE_PUT
|
||||
{ "put", cmd_put, 4, 7, "[-b|-n] [-f <remote-path>] -h <ip-address> <local-path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_PWD
|
||||
# ifndef CONFIG_NSH_DISABLE_PWD
|
||||
{ "pwd", cmd_pwd, 1, 1, NULL },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_RM
|
||||
# ifndef CONFIG_NSH_DISABLE_RM
|
||||
{ "rm", cmd_rm, 2, 2, "<file-path>" },
|
||||
# endif
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_RMDIR
|
||||
# ifndef CONFIG_NSH_DISABLE_RMDIR
|
||||
{ "rmdir", cmd_rmdir, 2, 2, "<dir-path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_SET
|
||||
# ifndef CONFIG_NSH_DISABLE_SET
|
||||
{ "set", cmd_set, 3, 3, "<name> <value>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_EXAMPLES_NSH_DISABLESCRIPT)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_SH
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
# ifndef CONFIG_NSH_DISABLE_SH
|
||||
{ "sh", cmd_sh, 2, 2, "<script-path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_SLEEP
|
||||
# ifndef CONFIG_NSH_DISABLE_SLEEP
|
||||
{ "sleep", cmd_sleep, 2, 2, "<sec>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_EXAMPLES_NSH_DISABLESCRIPT) && !defined(CONFIG_EXAMPLES_NSH_DISABLE_TEST)
|
||||
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
|
||||
{ "test", cmd_test, 3, NSH_MAX_ARGUMENTS, "<expression>" },
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_UMOUNT
|
||||
# ifndef CONFIG_NSH_DISABLE_UMOUNT
|
||||
{ "umount", cmd_umount, 2, 2, "<dir-path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_UNSET
|
||||
# ifndef CONFIG_NSH_DISABLE_UNSET
|
||||
{ "unset", cmd_unset, 2, 2, "<name>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_USLEEP
|
||||
# ifndef CONFIG_NSH_DISABLE_USLEEP
|
||||
{ "usleep", cmd_usleep, 2, 2, "<usec>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_GET
|
||||
# ifndef CONFIG_NSH_DISABLE_GET
|
||||
{ "wget", cmd_wget, 2, 4, "[-o <local-path>] <url>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_XD
|
||||
#ifndef CONFIG_NSH_DISABLE_XD
|
||||
{ "xd", cmd_xd, 3, 3, "<hex-address> <byte-count>" },
|
||||
#endif
|
||||
{ NULL, NULL, 1, 1, NULL }
|
||||
@ -352,7 +352,7 @@ const char g_fmtnosuch[] = "nsh: %s: no such %s: %s\n";
|
||||
const char g_fmttoomanyargs[] = "nsh: %s: too many arguments\n";
|
||||
const char g_fmtdeepnesting[] = "nsh: %s: nesting too deep\n";
|
||||
const char g_fmtcontext[] = "nsh: %s: not valid in this context\n";
|
||||
#ifdef CONFIG_EXAMPLES_NSH_STRERROR
|
||||
#ifdef CONFIG_NSH_STRERROR
|
||||
const char g_fmtcmdfailed[] = "nsh: %s: %s failed: %s\n";
|
||||
#else
|
||||
const char g_fmtcmdfailed[] = "nsh: %s: %s failed: %d\n";
|
||||
@ -371,18 +371,18 @@ const char g_fmtsignalrecvd[] = "nsh: %s: Interrupted by signal\n";
|
||||
* Name: cmd_help
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_HELP
|
||||
#ifndef CONFIG_NSH_DISABLE_HELP
|
||||
static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
const struct cmdmap_s *ptr;
|
||||
|
||||
nsh_output(vtbl, "NSH command forms:\n");
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
nsh_output(vtbl, " [nice [-d <niceness>>]] <cmd> [> <file>|>> <file>] [&]\n");
|
||||
#else
|
||||
nsh_output(vtbl, " <cmd> [> <file>|>> <file>]\n");
|
||||
#endif
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
nsh_output(vtbl, "OR\n");
|
||||
nsh_output(vtbl, " if <cmd>\n");
|
||||
nsh_output(vtbl, " then\n");
|
||||
@ -421,7 +421,7 @@ static int cmd_unrecognized(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_exit
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_EXIT
|
||||
#ifndef CONFIG_NSH_DISABLE_EXIT
|
||||
static int cmd_exit(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
nsh_exit(vtbl);
|
||||
@ -491,7 +491,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[])
|
||||
* a list of pre-built applications.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS
|
||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||
if (handler == cmd_unrecognized && nsh_execapp(vtbl, cmd, argv) == OK)
|
||||
{
|
||||
/* The pre-built application was successfully started -- return OK.
|
||||
@ -510,7 +510,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[])
|
||||
* Name: nsh_releaseargs
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static void nsh_releaseargs(struct cmdarg_s *arg)
|
||||
{
|
||||
FAR struct nsh_vtbl_s *vtbl = arg->vtbl;
|
||||
@ -544,7 +544,7 @@ static void nsh_releaseargs(struct cmdarg_s *arg)
|
||||
* Name: nsh_child
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static pthread_addr_t nsh_child(pthread_addr_t arg)
|
||||
{
|
||||
struct cmdarg_s *carg = (struct cmdarg_s *)arg;
|
||||
@ -568,7 +568,7 @@ static pthread_addr_t nsh_child(pthread_addr_t arg)
|
||||
* Name: nsh_cloneargs
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static inline struct cmdarg_s *nsh_cloneargs(FAR struct nsh_vtbl_s *vtbl,
|
||||
int fd, int argc, char *argv[])
|
||||
{
|
||||
@ -735,7 +735,7 @@ char *nsh_argument(FAR struct nsh_vtbl_s *vtbl, char **saveptr)
|
||||
* Name: nsh_cmdenabled
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
static inline bool nsh_cmdenabled(FAR struct nsh_vtbl_s *vtbl)
|
||||
{
|
||||
struct nsh_parser_s *np = &vtbl->np;
|
||||
@ -766,7 +766,7 @@ static inline bool nsh_cmdenabled(FAR struct nsh_vtbl_s *vtbl)
|
||||
* Name: nsh_ifthenelse
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
static inline int nsh_ifthenelse(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd, FAR char **saveptr)
|
||||
{
|
||||
struct nsh_parser_s *np = &vtbl->np;
|
||||
@ -800,7 +800,7 @@ static inline int nsh_ifthenelse(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
||||
|
||||
/* Check if we have exceeded the maximum depth of nesting */
|
||||
|
||||
if (np->np_ndx >= CONFIG_EXAMPLES_NSH_NESTDEPTH-1)
|
||||
if (np->np_ndx >= CONFIG_NSH_NESTDEPTH-1)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtdeepnesting, "if");
|
||||
goto errout;
|
||||
@ -909,7 +909,7 @@ static inline int nsh_saveresult(FAR struct nsh_vtbl_s *vtbl, bool result)
|
||||
{
|
||||
struct nsh_parser_s *np = &vtbl->np;
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
if (np->np_st[np->np_ndx].ns_state == NSH_PARSER_IF)
|
||||
{
|
||||
np->np_fail = false;
|
||||
@ -928,7 +928,7 @@ static inline int nsh_saveresult(FAR struct nsh_vtbl_s *vtbl, bool result)
|
||||
* Name: nsh_nice
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static inline int nsh_nice(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd, FAR char **saveptr)
|
||||
{
|
||||
FAR char *cmd = *ppcmd;
|
||||
@ -1016,7 +1016,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
||||
/* Initialize parser state */
|
||||
|
||||
memset(argv, 0, MAX_ARGV_ENTRIES*sizeof(FAR char *));
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
vtbl->np.np_bg = false;
|
||||
#endif
|
||||
vtbl->np.np_redirect = false;
|
||||
@ -1028,7 +1028,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
||||
|
||||
/* Handler if-then-else-fi */
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
if (nsh_ifthenelse(vtbl, &cmd, &saveptr) != 0)
|
||||
{
|
||||
goto errout;
|
||||
@ -1037,7 +1037,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
||||
|
||||
/* Handle nice */
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
if (nsh_nice(vtbl, &cmd, &saveptr) != 0)
|
||||
{
|
||||
goto errout;
|
||||
@ -1048,7 +1048,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
||||
* currently disabled.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
if (!cmd || !nsh_cmdenabled(vtbl))
|
||||
#else
|
||||
if (!cmd)
|
||||
@ -1088,7 +1088,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
||||
|
||||
/* Check if the command should run in background */
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
if (argc > 1 && strcmp(argv[argc-1], "&") == 0)
|
||||
{
|
||||
vtbl->np.np_bg = true;
|
||||
@ -1155,9 +1155,9 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
||||
* However is app is to be started as nuttapp new process will
|
||||
* be created anyway, so skip this step. */
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
if (vtbl->np.np_bg
|
||||
#ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS
|
||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||
&& nuttapp_isavail(argv[0]) < 0
|
||||
#endif
|
||||
)
|
||||
@ -1287,7 +1287,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
||||
|
||||
return nsh_saveresult(vtbl, false);
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
errout_with_redirect:
|
||||
if (vtbl->np.np_redirect)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@
|
||||
* Name: cmd_free
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_FREE
|
||||
#ifndef CONFIG_NSH_DISABLE_FREE
|
||||
int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
struct mallinfo mem;
|
||||
|
@ -74,7 +74,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_WGET
|
||||
# ifndef CONFIG_NSH_DISABLE_WGET
|
||||
# include <net/uip/uip-lib.h>
|
||||
# include <net/uip/webclient.h>
|
||||
# endif
|
||||
@ -143,7 +143,7 @@ static inline uint16_t ping_newid(void)
|
||||
* Name: uip_statistics
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_STATISTICS) && !defined(CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG)
|
||||
#if defined(CONFIG_NET_STATISTICS) && !defined(CONFIG_NSH_DISABLE_IFCONFIG)
|
||||
static inline void uip_statistics(FAR struct nsh_vtbl_s *vtbl)
|
||||
{
|
||||
nsh_output(vtbl, "uIP IP ");
|
||||
@ -405,7 +405,7 @@ errout:
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_WGET
|
||||
#ifndef CONFIG_NSH_DISABLE_WGET
|
||||
static void wget_callback(FAR char **buffer, int offset, int datend,
|
||||
FAR int *buflen, FAR void *arg)
|
||||
{
|
||||
@ -423,7 +423,7 @@ static void wget_callback(FAR char **buffer, int offset, int datend,
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_GET
|
||||
#ifndef CONFIG_NSH_DISABLE_GET
|
||||
int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
struct tftpc_args_s args;
|
||||
@ -463,7 +463,7 @@ int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_ifconfig
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG
|
||||
#ifndef CONFIG_NSH_DISABLE_IFCONFIG
|
||||
int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
netdev_foreach(ifconfig_callback, vtbl);
|
||||
@ -478,7 +478,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
|
||||
#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) && \
|
||||
!defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_DISABLE_SIGNALS)
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_PING
|
||||
#ifndef CONFIG_NSH_DISABLE_PING
|
||||
int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
FAR const char *fmt = g_fmtarginvalid;
|
||||
@ -641,7 +641,7 @@ errout:
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_PUT
|
||||
#ifndef CONFIG_NSH_DISABLE_PUT
|
||||
int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
struct tftpc_args_s args;
|
||||
@ -682,7 +682,7 @@ int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_WGET
|
||||
#ifndef CONFIG_NSH_DISABLE_WGET
|
||||
int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *localfile = NULL;
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/uip/uip-lib.h>
|
||||
#if defined(CONFIG_EXAMPLES_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
# include <net/uip/resolv.h>
|
||||
# include <net/uip/dhcpc.h>
|
||||
#endif
|
||||
@ -86,16 +86,16 @@
|
||||
int nsh_netinit(void)
|
||||
{
|
||||
struct in_addr addr;
|
||||
#if defined(CONFIG_EXAMPLES_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
FAR void *handle;
|
||||
#endif
|
||||
#if defined(CONFIG_EXAMPLES_NSH_DHCPC) || defined(CONFIG_EXAMPLES_NSH_NOMAC)
|
||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_NOMAC)
|
||||
uint8_t mac[IFHWADDRLEN];
|
||||
#endif
|
||||
|
||||
/* Many embedded network interfaces must have a software assigned MAC */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_NOMAC
|
||||
#ifdef CONFIG_NSH_NOMAC
|
||||
mac[0] = 0x00;
|
||||
mac[1] = 0xe0;
|
||||
mac[2] = 0xb0;
|
||||
@ -107,8 +107,8 @@ int nsh_netinit(void)
|
||||
|
||||
/* Set up our host address */
|
||||
|
||||
#if !defined(CONFIG_EXAMPLES_NSH_DHCPC)
|
||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_NSH_IPADDR);
|
||||
#if !defined(CONFIG_NSH_DHCPC)
|
||||
addr.s_addr = HTONL(CONFIG_NSH_IPADDR);
|
||||
#else
|
||||
addr.s_addr = 0;
|
||||
#endif
|
||||
@ -116,21 +116,21 @@ int nsh_netinit(void)
|
||||
|
||||
/* Set up the default router address */
|
||||
|
||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_NSH_DRIPADDR);
|
||||
addr.s_addr = HTONL(CONFIG_NSH_DRIPADDR);
|
||||
uip_setdraddr("eth0", &addr);
|
||||
|
||||
/* Setup the subnet mask */
|
||||
|
||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_NSH_NETMASK);
|
||||
addr.s_addr = HTONL(CONFIG_NSH_NETMASK);
|
||||
uip_setnetmask("eth0", &addr);
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
/* Set up the resolver */
|
||||
|
||||
resolv_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
/* Get the MAC address of the NIC */
|
||||
|
||||
uip_getmacaddr("eth0", mac);
|
||||
|
@ -98,7 +98,7 @@ static const char *g_statenames[] =
|
||||
* Name: ps_task
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_PS
|
||||
#ifndef CONFIG_NSH_DISABLE_PS
|
||||
static void ps_task(FAR _TCB *tcb, FAR void *arg)
|
||||
{
|
||||
struct nsh_vtbl_s *vtbl = (struct nsh_vtbl_s*)arg;
|
||||
@ -145,7 +145,7 @@ static void ps_task(FAR _TCB *tcb, FAR void *arg)
|
||||
* Name: cmd_exec
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_EXEC
|
||||
#ifndef CONFIG_NSH_DISABLE_EXEC
|
||||
int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *endptr;
|
||||
@ -167,7 +167,7 @@ int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_ps
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_PS
|
||||
#ifndef CONFIG_NSH_DISABLE_PS
|
||||
int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
nsh_output(vtbl, "PID PRI SCHD TYPE NP STATE NAME\n");
|
||||
@ -181,7 +181,7 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_KILL
|
||||
#ifndef CONFIG_NSH_DISABLE_KILL
|
||||
int cmd_kill(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *ptr;
|
||||
@ -255,7 +255,7 @@ invalid_arg:
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_SLEEP
|
||||
#ifndef CONFIG_NSH_DISABLE_SLEEP
|
||||
int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *endptr;
|
||||
@ -278,7 +278,7 @@ int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_USLEEP
|
||||
#ifndef CONFIG_NSH_DISABLE_USLEEP
|
||||
int cmd_usleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
char *endptr;
|
||||
|
@ -47,13 +47,13 @@
|
||||
|
||||
#include "nsh.h"
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_ROMFSETC
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
|
||||
/* Should we use the default ROMFS image? Or a custom, board-specific
|
||||
* ROMFS image?
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_ARCHROMFS
|
||||
#ifdef CONFIG_NSH_ARCHROMFS
|
||||
# include <arch/board/nsh_romfsimg.h>
|
||||
#else
|
||||
# include "nsh_romfsimg.h"
|
||||
@ -97,8 +97,8 @@ int nsh_romfsetc(void)
|
||||
|
||||
/* Create a ROM disk for the /etc filesystem */
|
||||
|
||||
ret = romdisk_register(CONFIG_EXAMPLES_NSH_ROMFSDEVNO, romfs_img,
|
||||
NSECTORS(romfs_img_len), CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE);
|
||||
ret = romdisk_register(CONFIG_NSH_ROMFSDEVNO, romfs_img,
|
||||
NSECTORS(romfs_img_len), CONFIG_NSH_ROMFSSECTSIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
dbg("nsh: romdisk_register failed: %d\n", -ret);
|
||||
@ -108,17 +108,17 @@ int nsh_romfsetc(void)
|
||||
/* Mount the file system */
|
||||
|
||||
vdbg("Mounting ROMFS filesystem at target=%s with source=%s\n",
|
||||
CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT, MOUNT_DEVNAME);
|
||||
CONFIG_NSH_ROMFSMOUNTPT, MOUNT_DEVNAME);
|
||||
|
||||
ret = mount(MOUNT_DEVNAME, CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT, "romfs", MS_RDONLY, NULL);
|
||||
ret = mount(MOUNT_DEVNAME, CONFIG_NSH_ROMFSMOUNTPT, "romfs", MS_RDONLY, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
dbg("nsh: mount(%s,%s,romfs) failed: %s\n",
|
||||
MOUNT_DEVNAME, CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT, errno);
|
||||
MOUNT_DEVNAME, CONFIG_NSH_ROMFSMOUNTPT, errno);
|
||||
return ERROR;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_EXAMPLES_NSH_ROMFSETC */
|
||||
#endif /* CONFIG_NSH_ROMFSETC */
|
||||
|
||||
|
@ -63,7 +63,7 @@ struct serial_s
|
||||
struct nsh_vtbl_s ss_vtbl;
|
||||
int ss_fd; /* Re-direct file descriptor */
|
||||
FILE *ss_stream; /* Re-direct stream */
|
||||
char ss_line[CONFIG_EXAMPLES_NSH_LINELEN];
|
||||
char ss_line[CONFIG_NSH_LINELEN];
|
||||
};
|
||||
|
||||
struct serialsave_s
|
||||
@ -76,7 +76,7 @@ struct serialsave_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static FAR struct nsh_vtbl_s *nsh_consoleclone(FAR struct nsh_vtbl_s *vtbl);
|
||||
static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl);
|
||||
#endif
|
||||
@ -108,7 +108,7 @@ static inline FAR struct serial_s *nsh_allocstruct(void)
|
||||
struct serial_s *pstate = (struct serial_s *)zalloc(sizeof(struct serial_s));
|
||||
if (pstate)
|
||||
{
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
pstate->ss_vtbl.clone = nsh_consoleclone;
|
||||
pstate->ss_vtbl.release = nsh_consolerelease;
|
||||
#endif
|
||||
@ -262,7 +262,7 @@ static FAR char *nsh_consolelinebuffer(FAR struct nsh_vtbl_s *vtbl)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static FAR struct nsh_vtbl_s *nsh_consoleclone(FAR struct nsh_vtbl_s *vtbl)
|
||||
{
|
||||
FAR struct serial_s *pstate = (FAR struct serial_s *)vtbl;
|
||||
@ -290,7 +290,7 @@ static FAR struct nsh_vtbl_s *nsh_consoleclone(FAR struct nsh_vtbl_s *vtbl)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl)
|
||||
{
|
||||
FAR struct serial_s *pstate = (FAR struct serial_s *)vtbl;
|
||||
@ -422,7 +422,7 @@ int nsh_consolemain(int argc, char *argv[])
|
||||
|
||||
/* Execute the startup script */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_ROMFSETC
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
(void)nsh_script(&pstate->ss_vtbl, "init", NSH_INITPATH);
|
||||
#endif
|
||||
|
||||
@ -437,7 +437,7 @@ int nsh_consolemain(int argc, char *argv[])
|
||||
|
||||
/* Get the next line of input */
|
||||
|
||||
if (fgets(pstate->ss_line, CONFIG_EXAMPLES_NSH_LINELEN, stdin))
|
||||
if (fgets(pstate->ss_line, CONFIG_NSH_LINELEN, stdin))
|
||||
{
|
||||
/* Parse process the command */
|
||||
|
||||
|
@ -59,14 +59,14 @@
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/uip/uip-lib.h>
|
||||
#if defined(CONFIG_EXAMPLES_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
# include <net/uip/resolv.h>
|
||||
# include <net/uip/dhcpc.h>
|
||||
#endif
|
||||
|
||||
#include "nsh.h"
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_TELNET
|
||||
#ifdef CONFIG_NSH_TELNET
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -89,7 +89,7 @@
|
||||
#define TELNET_DO 253
|
||||
#define TELNET_DONT 254
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_TELNETD_DUMPBUFFER
|
||||
#ifdef CONFIG_NSH_TELNETD_DUMPBUFFER
|
||||
# define nsh_telnetdump(vtbl,msg,buf,nb) nsh_dumpbuffer(vtbl,msg,buf,nb)
|
||||
#else
|
||||
# define nsh_telnetdump(vtbl,msg,buf,nb)
|
||||
@ -105,7 +105,7 @@ struct telnetio_s
|
||||
int tio_sockfd;
|
||||
uint8_t tio_bufndx;
|
||||
uint8_t tio_state;
|
||||
char tio_inbuffer[CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE];
|
||||
char tio_inbuffer[CONFIG_NSH_IOBUFFER_SIZE];
|
||||
};
|
||||
|
||||
struct redirect_s
|
||||
@ -134,15 +134,15 @@ struct telnetd_s
|
||||
struct telnetio_s *tn;
|
||||
struct redirect_s rd;
|
||||
} u;
|
||||
char tn_outbuffer[CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE];
|
||||
char tn_cmd[CONFIG_EXAMPLES_NSH_LINELEN];
|
||||
char tn_outbuffer[CONFIG_NSH_IOBUFFER_SIZE];
|
||||
char tn_cmd[CONFIG_NSH_LINELEN];
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static void tio_semtake(struct telnetio_s *tio);
|
||||
static FAR struct nsh_vtbl_s *nsh_telnetclone(FAR struct nsh_vtbl_s *vtbl);
|
||||
#endif
|
||||
@ -192,7 +192,7 @@ static FAR struct telnetd_s *nsh_allocstruct(void)
|
||||
struct telnetd_s *pstate = (struct telnetd_s *)zalloc(sizeof(struct telnetd_s));
|
||||
if (pstate)
|
||||
{
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
pstate->tn_vtbl.clone = nsh_telnetclone;
|
||||
pstate->tn_vtbl.release = nsh_telnetrelease;
|
||||
#endif
|
||||
@ -287,7 +287,7 @@ static void nsh_putchar(struct telnetd_s *pstate, uint8_t ch)
|
||||
|
||||
/* If a newline was added or if the buffer is full, then process it now */
|
||||
|
||||
if (ch == ISO_nl || tio->tio_bufndx == (CONFIG_EXAMPLES_NSH_LINELEN - 1))
|
||||
if (ch == ISO_nl || tio->tio_bufndx == (CONFIG_NSH_LINELEN - 1))
|
||||
{
|
||||
pstate->tn_cmd[tio->tio_bufndx] = '\0';
|
||||
nsh_telnetdump(&pstate->tn_vtbl, "TELNET CMD",
|
||||
@ -488,7 +488,7 @@ static void *nsh_connection(void *arg)
|
||||
|
||||
/* Execute the startup script */
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_NSH_ROMFSETC) && !defined(CONFIG_EXAMPLES_NSH_CONSOLE)
|
||||
#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_CONSOLE)
|
||||
(void)nsh_script(vtbl, "init", NSH_INITPATH);
|
||||
#endif
|
||||
|
||||
@ -504,7 +504,7 @@ static void *nsh_connection(void *arg)
|
||||
/* Read a buffer of data from the TELNET client */
|
||||
|
||||
ret = recv(tio->tio_sockfd, tio->tio_inbuffer,
|
||||
CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE, 0);
|
||||
CONFIG_NSH_IOBUFFER_SIZE, 0);
|
||||
if (ret > 0)
|
||||
{
|
||||
|
||||
@ -594,12 +594,12 @@ static int nsh_telnetoutput(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...)
|
||||
va_list ap;
|
||||
|
||||
/* Put the new info into the buffer. Here we are counting on the fact that
|
||||
* no output strings will exceed CONFIG_EXAMPLES_NSH_LINELEN!
|
||||
* no output strings will exceed CONFIG_NSH_LINELEN!
|
||||
*/
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(&pstate->tn_outbuffer[nbytes],
|
||||
(CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE - 1) - nbytes, fmt, ap);
|
||||
(CONFIG_NSH_IOBUFFER_SIZE - 1) - nbytes, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
/* Get the size of the new string just added and the total size of
|
||||
@ -611,7 +611,7 @@ static int nsh_telnetoutput(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...)
|
||||
|
||||
/* Expand any terminating \n to \r\n */
|
||||
|
||||
if (nbytes < (CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE - 2) &&
|
||||
if (nbytes < (CONFIG_NSH_IOBUFFER_SIZE - 2) &&
|
||||
pstate->tn_outbuffer[nbytes-1] == '\n')
|
||||
{
|
||||
pstate->tn_outbuffer[nbytes-1] = ISO_cr;
|
||||
@ -625,7 +625,7 @@ static int nsh_telnetoutput(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...)
|
||||
* maximum length string.
|
||||
*/
|
||||
|
||||
if (nbytes > CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE - CONFIG_EXAMPLES_NSH_LINELEN)
|
||||
if (nbytes > CONFIG_NSH_IOBUFFER_SIZE - CONFIG_NSH_LINELEN)
|
||||
{
|
||||
nsh_flush(pstate);
|
||||
}
|
||||
@ -686,7 +686,7 @@ static FAR char *nsh_telnetlinebuffer(FAR struct nsh_vtbl_s *vtbl)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static FAR struct nsh_vtbl_s *nsh_telnetclone(FAR struct nsh_vtbl_s *vtbl)
|
||||
{
|
||||
FAR struct telnetd_s *pstate = (FAR struct telnetd_s *)vtbl;
|
||||
@ -720,7 +720,7 @@ static FAR struct nsh_vtbl_s *nsh_telnetclone(FAR struct nsh_vtbl_s *vtbl)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
static void nsh_telnetrelease(FAR struct nsh_vtbl_s *vtbl)
|
||||
{
|
||||
FAR struct telnetd_s *pstate = (FAR struct telnetd_s *)vtbl;
|
||||
@ -846,8 +846,8 @@ int nsh_telnetmain(int argc, char *argv[])
|
||||
{
|
||||
/* Execute nsh_connection() on each connection to port 23 */
|
||||
|
||||
uip_server(HTONS(23), nsh_connection, CONFIG_EXAMPLES_NSH_STACKSIZE);
|
||||
uip_server(HTONS(23), nsh_connection, CONFIG_NSH_STACKSIZE);
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_EXAMPLES_NSH_TELNET */
|
||||
#endif /* CONFIG_NSH_TELNET */
|
||||
|
@ -70,7 +70,7 @@
|
||||
|
||||
#include "nsh.h"
|
||||
|
||||
#if !defined(CONFIG_EXAMPLES_NSH_DISABLESCRIPT) && !defined(CONFIG_EXAMPLES_NSH_DISABLE_TEST)
|
||||
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -434,4 +434,4 @@ int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_EXAMPLES_NSH_DISABLESCRIPT && !CONFIG_EXAMPLES_NSH_DISABLE_TEST */
|
||||
#endif /* !CONFIG_NSH_DISABLESCRIPT && !CONFIG_NSH_DISABLE_TEST */
|
||||
|
Loading…
Reference in New Issue
Block a user