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