summaryrefslogtreecommitdiff
path: root/apps/nshlib/nsh_parse.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-05 17:44:11 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-05 17:44:11 +0000
commit33ea935548e0389f36f583fd826a09b7277ce85c (patch)
tree1cb241b0a84123081c115f5f382fa207ad83cb68 /apps/nshlib/nsh_parse.c
parent3609cc6eb6f7f30654cb95b0ce02487c742c9487 (diff)
downloadnuttx-33ea935548e0389f36f583fd826a09b7277ce85c.tar.gz
nuttx-33ea935548e0389f36f583fd826a09b7277ce85c.tar.bz2
nuttx-33ea935548e0389f36f583fd826a09b7277ce85c.zip
I learned how to spell PSEUDO
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5010 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/nshlib/nsh_parse.c')
-rw-r--r--apps/nshlib/nsh_parse.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c
index 049444397..165f842fc 100644
--- a/apps/nshlib/nsh_parse.c
+++ b/apps/nshlib/nsh_parse.c
@@ -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)
/****************************************************************************
@@ -443,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);
}
@@ -516,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;
}
@@ -574,14 +575,14 @@ static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl)
static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
FAR const char *cmd = NULL;
-#ifdef CONFIG_NSH_HELP_TERSE
+#ifndef CONFIG_NSH_HELP_TERSE
bool verbose = false;
int i;
#endif
/* The command may be followed by a verbose option */
-#ifdef CONFIG_NSH_HELP_TERSE
+#ifndef CONFIG_NSH_HELP_TERSE
i = 1;
if (argc > i)
{
@@ -618,14 +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 */
-#ifdef CONFIG_NSH_HELP_TERSE
+#ifndef CONFIG_NSH_HELP_TERSE
if (verbose)
{
nsh_output(vtbl, "Where <cmd> is one of:\n");
@@ -637,7 +637,6 @@ static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
else
#endif
{
- nsh_output(vtbl, "help usage:");
help_cmd(vtbl, "help");
nsh_output(vtbl, "\n");
help_cmdlist(vtbl);