[U-Boot] [PATCH] Output strings from echo with puts where easy
Mike Frysinger
vapier at gentoo.org
Sat Aug 18 01:40:39 CEST 2012
On Friday 17 August 2012 16:55:18 Joe Hershberger wrote:
> --- a/common/cmd_echo.c
> +++ b/common/cmd_echo.c
>
> - while ((c = *p++) != '\0') {
> - if (c == '\\' && *p == 'c') {
> - putnl = 0;
> - p++;
> - } else {
> - putc(c);
> - }
> +
> + nls = strstr(p, "\\c");
> + if (nls) {
> + putnl = 0;
> + *nls = '\0';
> + puts(p);
> + puts(nls + 2);
> + *nls = '\\';
> + } else {
> + puts(p);
> }
> }
what if someone uses \c multiple times ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120817/a9ea0305/attachment.pgp>
More information about the U-Boot
mailing list