From patchwork Fri Aug 17 20:55:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hershberger X-Patchwork-Id: 178385 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 862402C00A4 for ; Sat, 18 Aug 2012 06:55:43 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 54F5328BE4; Fri, 17 Aug 2012 22:55:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SVAIOvrX7rLQ; Fri, 17 Aug 2012 22:55:40 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2174F28BDE; Fri, 17 Aug 2012 22:55:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 42BDD28BDE for ; Fri, 17 Aug 2012 22:55:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d6mHrBhIzSv7 for ; Fri, 17 Aug 2012 22:55:33 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from spamkiller05.natinst.com (mailserver5.natinst.com [130.164.80.5]) by theia.denx.de (Postfix) with ESMTP id 0E1DB28BDD for ; Fri, 17 Aug 2012 22:55:31 +0200 (CEST) Received: from mailserv58-us.natinst.com (nb-hsrp-1338.natinst.com [130.164.19.133]) by spamkiller05.natinst.com (8.14.4/8.14.4) with ESMTP id q7HKtQNx016502; Fri, 17 Aug 2012 15:55:26 -0500 Received: from linux-xvxi.natinst.com ([130.164.14.197]) by mailserv58-us.natinst.com (Lotus Domino Release 8.5.2FP3) with ESMTP id 2012081715552682-1270522 ; Fri, 17 Aug 2012 15:55:26 -0500 From: Joe Hershberger To: u-boot@lists.denx.de Date: Fri, 17 Aug 2012 15:55:18 -0500 Message-Id: <1345236918-19775-1-git-send-email-joe.hershberger@ni.com> X-Mailer: git-send-email 1.7.11.5 X-MIMETrack: Itemize by SMTP Server on MailServ58-US/AUS/H/NIC(Release 8.5.2FP3|July 10, 2011) at 08/17/2012 03:55:26 PM, Serialize by Router on MailServ58-US/AUS/H/NIC(Release 8.5.2FP3|July 10, 2011) at 08/17/2012 03:55:26 PM, Serialize complete at 08/17/2012 03:55:26 PM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.7.7855, 1.0.260, 0.0.0000 definitions=2012-08-17_03:2012-08-17, 2012-08-17, 1970-01-01 signatures=0 Cc: Joe Hershberger Subject: [U-Boot] [PATCH] Output strings from echo with puts where easy X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Change echo to puts charachters together where it knows about them together. This improves netconsole performance by greatly reducing the number of packets that are sent. Signed-off-by: Joe Hershberger --- common/cmd_echo.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/common/cmd_echo.c b/common/cmd_echo.c index 43a6da5..e04738f 100644 --- a/common/cmd_echo.c +++ b/common/cmd_echo.c @@ -28,19 +28,23 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; int putnl = 1; + char *nls; /* new-line suppression */ for (i = 1; i < argc; i++) { - char *p = argv[i], c; + char *p = argv[i]; if (i > 1) putc(' '); - 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); } }