]> git.ipfire.org Git - thirdparty/u-boot.git/blob - cmd/echo.c
efi_loader: replace find_smbios_table by library function
[thirdparty/u-boot.git] / cmd / echo.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 */
6
7 #include <common.h>
8 #include <command.h>
9
10 static int do_echo(struct cmd_tbl *cmdtp, int flag, int argc,
11 char *const argv[])
12 {
13 int i = 1;
14 bool space = false;
15 bool newline = true;
16
17 if (argc > 1) {
18 if (!strcmp(argv[1], "-n")) {
19 newline = false;
20 ++i;
21 }
22 }
23
24 for (; i < argc; ++i) {
25 if (space) {
26 putc(' ');
27 }
28 puts(argv[i]);
29 space = true;
30 }
31
32 if (newline)
33 putc('\n');
34
35 return 0;
36 }
37
38 U_BOOT_CMD(
39 echo, CONFIG_SYS_MAXARGS, 1, do_echo,
40 "echo args to console",
41 "[-n] [args..]\n"
42 " - echo args to console; -n suppresses newline"
43 );