File tree Expand file tree Collapse file tree 1 file changed +8
-17
lines changed Expand file tree Collapse file tree 1 file changed +8
-17
lines changed Original file line number Diff line number Diff line change 2323static int ot_console_cb (const char * abuf , uint16_t bufsize , void * context )
2424{
2525 (void ) context ;
26- if (bufsize > 0 )
27- {
26+ if (bufsize > 0 ) {
2827 printf ("%.*s" , bufsize , abuf );
2928 }
3029 return 0 ;
3130}
3231
3332static int ot_cmd (int argc , char * * argv )
3433{
35- char command [SHELL_DEFAULT_BUFSIZE ];
36- for (int i = 1 ; i < argc ; i ++ ){
37- if (i == 1 )
38- {
39- strncpy (command , argv [i ], SHELL_DEFAULT_BUFSIZE - 1 );
40- }
41- else
42- {
43- strncat (command , " " , SHELL_DEFAULT_BUFSIZE - strlen (command )- 1 );
44- strncat (command , argv [i ], SHELL_DEFAULT_BUFSIZE - strlen (command )- 1 );
45- }
34+ for (int i = 1 ; i < argc - 1 ; i ++ ) {
35+ char * arg = argv [i ];
36+ arg += strlen (arg );
37+ * arg = ' ' ;
4638 }
47-
48- if (strlen (command ) != 0 )
49- {
50- otCliConsoleInputLine (command , SHELL_DEFAULT_BUFSIZE );
39+ printf ("Command given: %s\n" , argv [1 ]);
40+ if (strlen (argv [0 ]) != 0 ) {
41+ otCliConsoleInputLine (argv [1 ], strlen (argv [1 ]));
5142 }
5243 return 0 ;
5344}
You can’t perform that action at this time.
0 commit comments