From 92fd8f5221ca528c2def13897c712d558adf1675 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 3 Jun 2011 20:27:30 +0000 Subject: More FTP bugfixes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3665 42af7a65-404d-4744-a932-0658087f49c3 --- apps/nshlib/nsh_apps.c | 28 +--------------------------- apps/nshlib/nsh_parse.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 27 deletions(-) (limited to 'apps/nshlib') diff --git a/apps/nshlib/nsh_apps.c b/apps/nshlib/nsh_apps.c index 0d460a391..ec3d6ec88 100644 --- a/apps/nshlib/nsh_apps.c +++ b/apps/nshlib/nsh_apps.c @@ -89,9 +89,6 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, FAR char *argv[]) { -#ifndef CONFIG_APPS_BINDIR - FAR const char * name; -#endif int ret = OK; /* Try to find command within pre-built application list. */ @@ -99,30 +96,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, ret = exec_namedapp(cmd, argv); if (ret < 0) { - int err = -errno; -#ifndef CONFIG_APPS_BINDIR - int i; - - /* On failure, list the set of available built-in commands */ - - nsh_output(vtbl, "Builtin Apps: "); - for (i = 0; (name = namedapp_getname(i)) != NULL; i++) - { - nsh_output(vtbl, "%s ", name); - } - nsh_output(vtbl, "\nand type 'help' for more NSH commands.\n\n"); - - /* If the failing command was '?', then do not report an error */ - - if (strcmp(cmd, "?") != 0) - { - return err; - } - - return OK; -#else - return err; -#endif + return -errno; } #ifdef CONFIG_SCHED_WAITPID diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index f6a778a03..5819def75 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -140,6 +140,10 @@ static const struct cmdmap_s g_cmdmap[] = { "[", cmd_lbracket, 4, NSH_MAX_ARGUMENTS, " ]" }, #endif +#ifndef CONFIG_NSH_DISABLE_HELP + { "?", cmd_help, 1, 1, NULL }, +#endif + #if CONFIG_NFILE_DESCRIPTORS > 0 # ifndef CONFIG_NSH_DISABLE_CAT { "cat", cmd_cat, 2, NSH_MAX_ARGUMENTS, " [ [ ...]]" }, @@ -391,6 +395,10 @@ const char g_fmtsignalrecvd[] = "nsh: %s: Interrupted by signal\n"; static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { const struct cmdmap_s *ptr; +#ifdef CONFIG_NSH_BUILTIN_APPS + FAR const char * name; + int i; +#endif nsh_output(vtbl, "NSH command forms:\n"); #ifndef CONFIG_NSH_DISABLEBG @@ -419,6 +427,17 @@ static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) nsh_output(vtbl, " %s\n", ptr->cmd); } } + + /* List the set of available built-in commands */ + +#ifdef CONFIG_NSH_BUILTIN_APPS + nsh_output(vtbl, "\nBuiltin Apps: "); + for (i = 0; (name = namedapp_getname(i)) != NULL; i++) + { + nsh_output(vtbl, " %s\n", name); + } +#endif + return OK; } #endif -- cgit v1.2.3