Tomas Vanek

shell_printf() shell.c KSDK 1.1.0

Discussion created by Tomas Vanek on Mar 10, 2015
Latest reply on Oct 13, 2015 by David E Seymour

Shell code uses shell_printf for output. However standard printf is used at two places. It is a problem when you use context->ops->send_data for output.


--- a/KSDK-1.1.0/utilities/shell/src/shell.c    2014-12-17 11:42:10.000000000 +0100

+++ b/KSDK-1.1.0/utilities/shell/src/shell.c    2015-03-10 22:19:58.152395878 +0100

@@ -250,7 +250,7 @@

                 int i;

                 memmove(&context->line[context->c_pos],&context->line[context->c_pos + 1],context->l_pos - context->c_pos);

                 context->line[context->l_pos] = 0;

-                printf("\b%s  \b", &context->line[context->c_pos]);

+                shell_printf(context, "\b%s  \b", &context->line[context->c_pos]);

 

                 /* reset postion */

                 for (i = context->c_pos; i <= context->l_pos; i++)

@@ -296,7 +296,7 @@

             /* move the cursor to new position */

             for (i = context->c_pos; i < context->l_pos; i++)

             {

-                printf("\b");

+                shell_printf(context, "\b");

             }

         }

         else

Outcomes