diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-07-01 13:43:40 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-07-01 13:43:40 -0600 |
commit | e962ace77e7128655b4dce73b1a943ca994b9fb5 (patch) | |
tree | 5ec09347477700ab9a55c4c949b75a15ff3ff007 /apps | |
parent | cdb5a7864167327c84394786f00030f8f9a74f87 (diff) | |
download | px4-nuttx-e962ace77e7128655b4dce73b1a943ca994b9fb5.tar.gz px4-nuttx-e962ace77e7128655b4dce73b1a943ca994b9fb5.tar.bz2 px4-nuttx-e962ace77e7128655b4dce73b1a943ca994b9fb5.zip |
NSH: if # appears on line, need to comment ignore additinal commands on the line
Diffstat (limited to 'apps')
-rw-r--r-- | apps/nshlib/nsh_parse.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index b0aa4c05c..a089aa5ec 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -196,7 +196,7 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline); static const char g_token_separator[] = " \t\n"; #ifndef NSH_DISABLE_SEMICOLON -static const char g_line_separator[] = "\";\n"; +static const char g_line_separator[] = "\"#;\n"; #endif #ifdef CONFIG_NSH_ARGCAT static const char g_arg_separator[] = "`$"; @@ -2191,22 +2191,23 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline) np->np_loffs = (uint16_t)(working - cmdline); #endif /* A command may be terminated with a newline character, the end of the - * line, or a semicolon. NOTE that the set of delimiting characters - * includes the quotation mark. We need to handle quotation marks here - * because a semicolon or newline character within a quoted string must - * be ignored. + * line, a semicolon, or a '#' character. NOTE that the set of + * delimiting characters includes the quotation mark. We need to + * handle quotation marks here because any other delimiter within a + * quoted string must be treated as normal text. */ len = strcspn(working, g_line_separator); ptr = working + len; /* Check for the last command on the line. This means that the none - * of the delimiting characters was found or that the newline character - * was found. Anything after the newline character is ignored (there - * should not be anything. + * of the delimiting characters was found or that the newline or '#' + * character was found. Anything after the newline or '#' character + * is ignored (there should not be anything after a newline, of + * course). */ - if (*ptr == '\0' || *ptr == '\n') + if (*ptr == '\0' || *ptr == '\n' || *ptr == '#') { /* Parse the last command on the line */ |