/* * Copyright 2000-2009 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * SPDX-License-Identifier: GPL-2.0+ */ #include "common.h" #include "command.h" command_ret_t do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { uint_fast8_t putnl = 1; (void) cmdtp; (void) flag; for (uint_fast8_t i = 1; i < argc; i++) { uint_fast8_t backslash = 0; char *p = argv[i]; char c; if (i != 1) putchar(' '); while ((c = *p++) != '\0') { if(backslash) { backslash = 0; if (c == 'c') { putnl = 0; continue; } else putchar('\\'); } else { if (c == '\\') { backslash = 1; continue; } } putchar(c); } } if (putnl) putchar('\n'); return CMD_RET_SUCCESS; } #if 0 U_BOOT_CMD( echo, CONFIG_SYS_MAXARGS, 1, do_echo, "echo args to console", "[args..]\n" " - echo args to console; \\c suppresses newline" ); #endif