]> Git Repo - J-u-boot.git/blob - cmd/echo.c
sunxi: h616: add Tanix TX1 support
[J-u-boot.git] / cmd / echo.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright 2000-2009
4  * Wolfgang Denk, DENX Software Engineering, [email protected].
5  */
6
7 #include <command.h>
8
9 static int do_echo(struct cmd_tbl *cmdtp, int flag, int argc,
10                    char *const argv[])
11 {
12         int i = 1;
13         bool space = false;
14         bool newline = true;
15
16         if (argc > 1) {
17                 if (!strcmp(argv[1], "-n")) {
18                         newline = false;
19                         ++i;
20                 }
21         }
22
23         for (; i < argc; ++i) {
24                 if (space) {
25                         putc(' ');
26                 }
27                 puts(argv[i]);
28                 space = true;
29         }
30
31         if (newline)
32                 putc('\n');
33
34         return 0;
35 }
36
37 U_BOOT_CMD(
38         echo, CONFIG_SYS_MAXARGS, 1, do_echo,
39         "echo args to console",
40         "[-n] [args..]\n"
41         "    - echo args to console; -n suppresses newline"
42 );
This page took 0.024464 seconds and 4 git commands to generate.