From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Fri, 17 Aug 2012 19:40:39 -0400 Subject: [U-Boot] [PATCH] Output strings from echo with puts where easy In-Reply-To: <1345236918-19775-1-git-send-email-joe.hershberger@ni.com> References: <1345236918-19775-1-git-send-email-joe.hershberger@ni.com> Message-ID: <201208171940.40143.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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: