Skip to content

Commit bf9f69d

Browse files
committed
fixup! sys/shell: integrate OpenThread CLI into RIOT shell
1 parent 0c426cb commit bf9f69d

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

sys/shell/cmds/openthread.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,22 @@
2323
static 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

3332
static 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
}

0 commit comments

Comments
 (0)