Skip to content
Snippets Groups Projects
Commit bb64d1c9 authored by Joe Hershberger's avatar Joe Hershberger Committed by Tom Rini
Browse files

Output strings from echo with puts where easy


Change echo to puts characters together where it knows about them
together.  This improves netconsole performance by greatly reducing
the number of packets that are sent.

Signed-off-by: default avatarJoe Hershberger <joe.hershberger@ni.com>
parent da83bcd7
No related branches found
No related tags found
No related merge requests found
......@@ -30,17 +30,31 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int putnl = 1;
for (i = 1; i < argc; i++) {
char *p = argv[i], c;
char *p = argv[i];
char *nls; /* new-line suppression */
if (i > 1)
putc(' ');
while ((c = *p++) != '\0') {
if (c == '\\' && *p == 'c') {
putnl = 0;
p++;
} else {
putc(c);
nls = strstr(p, "\\c");
if (nls) {
char *prenls = p;
putnl = 0;
/*
* be paranoid and guess that someone might
* say \c more than once
*/
while (nls) {
*nls = '\0';
puts(prenls);
*nls = '\\';
prenls = nls + 2;
nls = strstr(prenls, "\\c");
}
puts(prenls);
} else {
puts(p);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment