NSH: Separate command line parsing from command execution. Add support for multiple, semicolone separated commands on each line

This commit is contained in:
Gregory Nutt 2014-01-10 15:23:26 -06:00
parent a6bb107d10
commit 25fd6d1904
4 changed files with 53 additions and 9 deletions

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
<p>Last Updated: December 5, 2013</p>
<p>Last Updated: January 10, 2014</p>
</td>
</tr>
</table>
@ -543,6 +543,11 @@ nsh&gt;
The default niceness is 10.
</p>
<p>
<b>Multiple commands per line</b>.
NSH will accept multiple commands per command line with each command separated with the semi-colon character (;).
</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
@ -2650,6 +2655,13 @@ nsh>
Default: 80
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_NSH_DISABLE_SEMICOLON</code></b></td>
<td>
By default, you can enter multiple NSH commands on a line with each command separated by a semicolon.
You can disable this feature to save a little memory on FLASH challenged platforms.
Default: n
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_NSH_NESTDEPTH</code></b></td>

View File

@ -603,6 +603,7 @@ CONFIG_NSH_DISABLE_WGET=y
CONFIG_NSH_CODECS_BUFSIZE=128
CONFIG_NSH_FILEIOSIZE=64
CONFIG_NSH_LINELEN=80
CONFIG_NSH_DISABLE_SEMICOLON=y
CONFIG_NSH_MAXARGUMENTS=6
CONFIG_NSH_NESTDEPTH=3
CONFIG_NSH_DISABLESCRIPT=y

View File

@ -40,7 +40,9 @@ CONFIG_HOST_LINUX=y
#
# CONFIG_DEBUG is not set
# CONFIG_ARCH_HAVE_STACKCHECK is not set
# CONFIG_ARCH_HAVE_HEAPCHECK is not set
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_NOOPT=y
#
# System Type
@ -70,7 +72,7 @@ CONFIG_ARCH="sim"
# CONFIG_ARCH_NOINTC is not set
# CONFIG_ARCH_VECNOTIRQ is not set
# CONFIG_ARCH_DMA is not set
# CONFIG_ARCH_IRQPRIO is not set
# CONFIG_ARCH_HAVE_IRQPRIO is not set
# CONFIG_CUSTOM_STACK is not set
# CONFIG_ADDRENV is not set
# CONFIG_ARCH_HAVE_VFORK is not set
@ -85,6 +87,12 @@ CONFIG_ARCH="sim"
CONFIG_BOARD_LOOPSPERMSEC=0
# CONFIG_ARCH_CALIBRATION is not set
#
# Interrupt options
#
# CONFIG_ARCH_HAVE_INTERRUPTSTACK is not set
# CONFIG_ARCH_HAVE_HIPRI_INTERRUPT is not set
#
# Boot options
#
@ -121,6 +129,7 @@ CONFIG_NSH_MMCSDMINOR=0
#
# CONFIG_BOARD_INITIALIZE is not set
CONFIG_MSEC_PER_TICK=10
# CONFIG_SYSTEM_TIME64 is not set
CONFIG_RR_INTERVAL=0
# CONFIG_SCHED_INSTRUMENTATION is not set
CONFIG_TASK_NAME_SIZE=32
@ -191,13 +200,17 @@ CONFIG_DEV_NULL=y
# CONFIG_LOOP is not set
# CONFIG_RAMDISK is not set
# CONFIG_CAN is not set
# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set
# CONFIG_PWM is not set
# CONFIG_ARCH_HAVE_I2CRESET is not set
# CONFIG_I2C is not set
# CONFIG_SPI is not set
# CONFIG_I2S is not set
# CONFIG_RTC is not set
# CONFIG_WATCHDOG is not set
# CONFIG_ANALOG is not set
# CONFIG_AUDIO_DEVICES is not set
# CONFIG_VIDEO_DEVICES is not set
# CONFIG_BCH is not set
# CONFIG_INPUT is not set
# CONFIG_LCD is not set
@ -207,6 +220,7 @@ CONFIG_DEV_NULL=y
# CONFIG_PM is not set
# CONFIG_POWER is not set
# CONFIG_SENSORS is not set
# CONFIG_SERCOMM_CONSOLE is not set
CONFIG_SERIAL=y
# CONFIG_DEV_LOWCONSOLE is not set
# CONFIG_16550_UART is not set
@ -233,6 +247,8 @@ CONFIG_SERIAL=y
#
# Networking Support
#
# CONFIG_ARCH_HAVE_NET is not set
# CONFIG_ARCH_HAVE_PHY is not set
# CONFIG_NET is not set
#
@ -243,6 +259,8 @@ CONFIG_SERIAL=y
# File system configuration
#
# CONFIG_DISABLE_MOUNTPOINT is not set
CONFIG_FS_READABLE=y
CONFIG_FS_WRITABLE=y
# CONFIG_FS_RAMMAP is not set
CONFIG_FS_FAT=y
CONFIG_FAT_LCNAMES=y
@ -254,6 +272,7 @@ CONFIG_FAT_MAXFNAME=32
CONFIG_FS_ROMFS=y
# CONFIG_FS_SMARTFS is not set
CONFIG_FS_BINFS=y
# CONFIG_FS_PROCFS is not set
#
# System Logging
@ -349,6 +368,7 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
#
# CONFIG_EXAMPLES_BUTTONS is not set
# CONFIG_EXAMPLES_CAN is not set
# CONFIG_EXAMPLES_CONFIGDATA is not set
# CONFIG_EXAMPLES_DHCPD is not set
# CONFIG_EXAMPLES_ELF is not set
# CONFIG_EXAMPLES_FTPC is not set
@ -416,14 +436,11 @@ CONFIG_EXAMPLES_NSH=y
# Networking Utilities
#
# CONFIG_NETUTILS_CODECS is not set
# CONFIG_NETUTILS_DHCPC is not set
# CONFIG_NETUTILS_DHCPD is not set
# CONFIG_NETUTILS_FTPC is not set
# CONFIG_NETUTILS_FTPD is not set
# CONFIG_NETUTILS_JSON is not set
# CONFIG_NETUTILS_RESOLV is not set
# CONFIG_NETUTILS_SMTP is not set
# CONFIG_NETUTILS_TELNETD is not set
# CONFIG_NETUTILS_TFTPC is not set
# CONFIG_NETUTILS_THTTPD is not set
# CONFIG_NETUTILS_UIPLIB is not set
@ -444,11 +461,13 @@ CONFIG_NSH_FILE_APPS=y
#
# Disable Individual commands
#
# CONFIG_NSH_DISABLE_ADDROUTE is not set
# CONFIG_NSH_DISABLE_CAT is not set
# CONFIG_NSH_DISABLE_CD is not set
# CONFIG_NSH_DISABLE_CP is not set
# CONFIG_NSH_DISABLE_CMP is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_DELROUTE is not set
# CONFIG_NSH_DISABLE_ECHO is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
@ -490,8 +509,10 @@ CONFIG_NSH_FILE_APPS=y
#
# CONFIG_NSH_CMDOPT_DF_H is not set
CONFIG_NSH_CODECS_BUFSIZE=128
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
# CONFIG_NSH_DISABLE_SEMICOLON is not set
CONFIG_NSH_MAXARGUMENTS=6
CONFIG_NSH_NESTDEPTH=3
# CONFIG_NSH_DISABLESCRIPT is not set
@ -519,6 +540,11 @@ CONFIG_NSH_CONSOLE=y
# NxWidgets/NxWM
#
#
# Platform-specific Support
#
# CONFIG_PLATFORM_CONFIGDATA is not set
#
# System NSH Add-Ons
#
@ -549,6 +575,11 @@ CONFIG_NSH_CONSOLE=y
# FLASH Erase-all Command
#
#
# NxPlayer media player library / command Line
#
# CONFIG_SYSTEM_NXPLAYER is not set
#
# RAM test
#

View File

@ -45,11 +45,11 @@
* Global Functions
****************************************************************************/
char *strstr(const char *str, const char *substr)
FAR char *strstr(FAR const char *str, FAR const char *substr)
{
const char *candidate; /* Candidate in str with matching start character */
char ch; /* First character of the substring */
int len; /* The length of the substring */
FAR const char *candidate; /* Candidate in str with matching start character */
char ch; /* First character of the substring */
int len; /* The length of the substring */
/* Special case the empty substring */