Merge branch 'NuttX/master'

This commit is contained in:
px4dev
2012-08-11 12:03:04 -07:00
43 changed files with 849 additions and 497 deletions
+19 -10
View File
@@ -371,9 +371,15 @@ o get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path>
Selects either binary ("octect") or test ("netascii") transfer
mode. Default: text.
o help
o help [-v] [<cmd>]
Presents summary information about each command to console.
Presents summary information about NSH commands to console. Options:
-v
Show verbose output will full command usage
<cmd>
Show full command usage only for this command
o ifconfig
@@ -499,14 +505,14 @@ o mkfatfs <path>
Format a fat file system on the block device specified by path.
NSH provides this command to access the mkfatfs() NuttX API.
This block device must reside in the NuttX psuedo filesystem and
This block device must reside in the NuttX pseudo filesystem and
must have been created by some call to register_blockdriver() (see
include/nuttx/fs/fs.h).
o mkfifo <path>
Creates a FIFO character device anywhere in the pseudo file system,
creating whatever psuedo directories that may be needed to complete
creating whatever pseudo directories that may be needed to complete
the full path. By convention, however, device drivers are place in
the standard /dev directory. After it is created, the FIFO device
may be used as any other device driver. NSH provides this command
@@ -578,7 +584,7 @@ o mount [-t <fstype> <block-device> <dir-path>]
If the mount parameters are provied on the command after the 'mount'
command, then the 'mount' command will mount a file system in the
NuttX psuedo-file system. 'mount' performs a three way association,
NuttX pseudo-file system. 'mount' performs a three way association,
binding:
File system. The '-t <fstype>' option identifies the type of
@@ -586,19 +592,19 @@ o mount [-t <fstype> <block-device> <dir-path>]
of this writing, vfat is the only supported value for <fstype>
Block Device. The <block-device> argument is the full or relative
path to a block driver inode in the psuedo filesystem. By convention,
path to a block driver inode in the pseudo filesystem. By convention,
this is a name under the /dev sub-directory. This <block-device>
must have been previously formatted with the same file system
type as specified by <fstype>
Mount Point. The mount point is the location in the psuedo file
Mount Point. The mount point is the location in the pseudo file
system where the mounted volume will appear. This mount point
can only reside in the NuttX psuedo filesystem. By convention, this
can only reside in the NuttX pseudo filesystem. By convention, this
mount point is a subdirectory under /mnt. The mount command will
create whatever psuedo directories that may be needed to complete
create whatever pseudo directories that may be needed to complete
the full path but the full path must not already exist.
After the volume has been mounted in the NuttX psuedo file
After the volume has been mounted in the NuttX pseudo file
system, it may be access in the same way as other objects in the
file system.
@@ -889,6 +895,9 @@ also allow it to squeeze into very small memory footprints.
CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET,
CONFIG_NSH_DISABLE_XD
Verbose help output can be suppressed by defining CONFIG_NSH_HELP_TERSE. In that
case, the help command is still available but will be slightly smaller.
NSH-Specific Configuration Settings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+24 -10
View File
@@ -88,12 +88,12 @@
# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+4)
#endif
/* Help layout */
/* Help command summary layout */
#define MAX_CMDLEN 12
#define CMDS_PER_LINE 5
#define CMDS_PER_LINE 6
#define NUM_CMDS (sizeof(g_cmdmap)/sizeof(struct cmdmap_s))
#define NUM_CMDS ((sizeof(g_cmdmap)/sizeof(struct cmdmap_s)) - 1)
#define NUM_CMD_ROWS ((NUM_CMDS + (CMDS_PER_LINE-1)) / CMDS_PER_LINE)
/****************************************************************************
@@ -211,7 +211,11 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#ifndef CONFIG_NSH_DISABLE_HELP
{ "help", cmd_help, 1, 3, "[-v] [cmd]" },
# ifdef CONFIG_NSH_HELP_TERSE
{ "help", cmd_help, 1, 2, "[<cmd>]" },
#else
{ "help", cmd_help, 1, 3, "[-v] [<cmd>]" },
# endif
#endif
#ifdef CONFIG_NET
@@ -439,7 +443,7 @@ static inline void help_cmdlist(FAR struct nsh_vtbl_s *vtbl)
for (i = 0; i < NUM_CMD_ROWS; i++)
{
nsh_output(vtbl, " ");
for (j = 0, k = i; j < CMDS_PER_LINE && k < NUM_CMDS; j++, k += CMDS_PER_LINE)
for (j = 0, k = i; j < CMDS_PER_LINE && k < NUM_CMDS; j++, k += NUM_CMD_ROWS)
{
nsh_output(vtbl, "%-12s", g_cmdmap[k].cmd);
}
@@ -453,7 +457,7 @@ static inline void help_cmdlist(FAR struct nsh_vtbl_s *vtbl)
* Name: help_usage
****************************************************************************/
#ifndef CONFIG_NSH_DISABLE_HELP
#if !defined(CONFIG_NSH_DISABLE_HELP) && !defined(CONFIG_NSH_HELP_TERSE)
static inline void help_usage(FAR struct nsh_vtbl_s *vtbl)
{
nsh_output(vtbl, "NSH command forms:\n");
@@ -512,6 +516,7 @@ static int help_cmd(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd)
{
/* Yes... show it */
nsh_output(vtbl, "%s usage:", cmd);
help_showcmd(vtbl, cmdmap);
return OK;
}
@@ -526,7 +531,7 @@ static int help_cmd(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd)
* Name: help_allcmds
****************************************************************************/
#ifndef CONFIG_NSH_DISABLE_HELP
#if !defined(CONFIG_NSH_DISABLE_HELP) && !defined(CONFIG_NSH_HELP_TERSE)
static inline void help_allcmds(FAR struct nsh_vtbl_s *vtbl)
{
FAR const struct cmdmap_s *cmdmap;
@@ -569,12 +574,15 @@ static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl)
#ifndef CONFIG_NSH_DISABLE_HELP
static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
bool verbose = false;
FAR const char *cmd = NULL;
#ifndef CONFIG_NSH_HELP_TERSE
bool verbose = false;
int i;
#endif
/* The command may be followed by a verbose option */
#ifndef CONFIG_NSH_HELP_TERSE
i = 1;
if (argc > i)
{
@@ -598,6 +606,12 @@ static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
help_usage(vtbl);
}
#else
if (argc > 1)
{
cmd = argv[1];
}
#endif
/* Are we showing help on a single command? */
@@ -605,13 +619,13 @@ static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
/* Yes.. show the single command */
nsh_output(vtbl, "%s usage:", cmd);
help_cmd(vtbl, cmd);
}
else
{
/* In verbose mode, show detailed help for all commands */
#ifndef CONFIG_NSH_HELP_TERSE
if (verbose)
{
nsh_output(vtbl, "Where <cmd> is one of:\n");
@@ -621,8 +635,8 @@ static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* Otherwise, just show the list of command names */
else
#endif
{
nsh_output(vtbl, "help usage:");
help_cmd(vtbl, "help");
nsh_output(vtbl, "\n");
help_cmdlist(vtbl);