mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
nsh/echo: Fix echo previous behavior, single write with '\n'
This commit fixes the previous behavior where an echo with a single string and its default new line is send as single write(). This issue came from: https://github.com/apache/nuttx-apps/pull/1559 Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
parent
fee2ddbf54
commit
ae718ba47f
1 changed files with 9 additions and 10 deletions
|
|
@ -390,19 +390,18 @@ do_echo:
|
|||
str_escape(argv[0]);
|
||||
}
|
||||
|
||||
nsh_output(vtbl, "%s", argv[0]);
|
||||
if (argc > 1)
|
||||
{
|
||||
nsh_output(vtbl, "%s ", argv[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
nsh_output(vtbl, newline ? "%s\n" : "%s", argv[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
--argc;
|
||||
++argv;
|
||||
if (argc > 0)
|
||||
{
|
||||
nsh_output(vtbl, " ");
|
||||
}
|
||||
}
|
||||
|
||||
if (newline)
|
||||
{
|
||||
nsh_output(vtbl, "\n");
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue