2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2009-10-16 22:36:25 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2000-2009
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
|
|
|
|
2020-05-10 17:40:03 +00:00
|
|
|
static int do_echo(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
|
|
char *const argv[])
|
2009-10-16 22:36:25 +00:00
|
|
|
{
|
2021-01-20 11:13:30 +00:00
|
|
|
int i = 1;
|
|
|
|
bool space = false;
|
|
|
|
bool newline = true;
|
|
|
|
|
|
|
|
if (argc > 1) {
|
|
|
|
if (!strcmp(argv[1], "-n")) {
|
|
|
|
newline = false;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
2009-10-16 22:36:25 +00:00
|
|
|
|
2021-01-20 11:13:30 +00:00
|
|
|
for (; i < argc; ++i) {
|
|
|
|
if (space) {
|
2009-10-16 22:36:25 +00:00
|
|
|
putc(' ');
|
|
|
|
}
|
2021-01-20 11:13:30 +00:00
|
|
|
puts(argv[i]);
|
|
|
|
space = true;
|
2009-10-16 22:36:25 +00:00
|
|
|
}
|
|
|
|
|
2021-01-20 11:13:30 +00:00
|
|
|
if (newline)
|
2009-10-16 22:36:25 +00:00
|
|
|
putc('\n');
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
U_BOOT_CMD(
|
2021-01-20 11:13:30 +00:00
|
|
|
echo, CONFIG_SYS_MAXARGS, 1, do_echo,
|
2009-10-16 22:36:25 +00:00
|
|
|
"echo args to console",
|
2021-01-20 11:13:30 +00:00
|
|
|
"[-n] [args..]\n"
|
|
|
|
" - echo args to console; -n suppresses newline"
|
2009-10-16 22:36:25 +00:00
|
|
|
);
|