Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nuttx-apps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
nuttx-apps
Commits
58424404
Commit
58424404
authored
10 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
NSH: if # appears on line, need to comment ignore additinal commands on the line
parent
44ea3903
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nshlib/nsh_parse.c
+10
-9
10 additions, 9 deletions
nshlib/nsh_parse.c
with
10 additions
and
9 deletions
nshlib/nsh_parse.c
+
10
−
9
View file @
58424404
...
...
@@ -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 */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment