diff options
author | Leo C | 2014-10-23 13:07:27 +0200 |
---|---|---|
committer | Leo C | 2014-10-23 13:07:27 +0200 |
commit | 889202c46ced1be4fc0db3faf63564722eba2865 (patch) | |
tree | 59b44dba123e04f45fd02be22674269fc3f1e56d /avr/cmd_misc.c | |
parent | 89adce76dd02f2076ec6de1c6b434bc1f29512f4 (diff) | |
download | z180-stamp-889202c46ced1be4fc0db3faf63564722eba2865.zip |
include cleanup
Diffstat (limited to 'avr/cmd_misc.c')
-rw-r--r-- | avr/cmd_misc.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/avr/cmd_misc.c b/avr/cmd_misc.c new file mode 100644 index 0000000..7ab8fef --- /dev/null +++ b/avr/cmd_misc.c @@ -0,0 +1,58 @@ +/* + * 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 |