char get_cmd(char *argv[], char max_argc)
{
static char cmd[MAX_CMD_LENGTH+1];
char *c = cmd, argc = 0;
while (1) {
if (__kfifo_out(&recvfifo, c, 1) == 0) {
if (!TIMERA_STARTED)
LPM4; // enter low power mode 4
continue;
}
if (((c - cmd) >= (sizeof(cmd)-1)) ||
*c == '\n') {
*c = '\0';
break;
}
c++;
}
*argv = strtok(cmd, " ");
while(*argv++ && argc < max_argc) {
*argv = strtok(NULL, " ");
argc++;
}
return argc; |