mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
Merged in juniskane/apps_upstream/echo_fix_pr (pull request #135)
apps/nshlib: Fix echo command with zero arguments, broken after commit 8ecf618
Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
parent
c40cf98468
commit
052a7009b3
1 changed files with 2 additions and 2 deletions
|
|
@ -264,13 +264,13 @@ int cmd_echo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
int i;
|
||||
int s = 1;
|
||||
|
||||
if (0 == strncmp(argv[1], "-n", 2))
|
||||
if (argc > 1 && 0 == strncmp(argv[1], "-n", 2))
|
||||
{
|
||||
s = 2;
|
||||
}
|
||||
|
||||
/* echo each argument, separated by a space as it must have been on the
|
||||
* command line
|
||||
* command line.
|
||||
*/
|
||||
|
||||
for (i = s; i < argc; i++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue