public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Output strings from echo with puts where easy
@ 2012-08-17 20:55 Joe Hershberger
  2012-08-17 23:40 ` Mike Frysinger
  2012-10-03 23:09 ` [U-Boot] [PATCH v2] " Joe Hershberger
  0 siblings, 2 replies; 4+ messages in thread
From: Joe Hershberger @ 2012-08-17 20:55 UTC (permalink / raw)
  To: u-boot

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 <joe.hershberger@ni.com>
---
 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);
 		}
 	}
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-04  1:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-17 20:55 [U-Boot] [PATCH] Output strings from echo with puts where easy Joe Hershberger
2012-08-17 23:40 ` Mike Frysinger
2012-10-03 23:09 ` [U-Boot] [PATCH v2] " Joe Hershberger
2012-10-04  1:20   ` [U-Boot] [U-Boot, " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox