cmd handler stuff

This commit is contained in:
Wolfgang Hottgenroth 2020-11-16 15:56:22 +01:00
parent ab3a6ac5ac
commit 0a2e630231
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -82,7 +82,7 @@ const static cmd_t COMMANDS[] = {
// returns -1 to close the connection
// returns 1 to toggle to config mode
// returns 2 to toggle back to default mode
int8_t cmdExecuteCommand(uint8_t *cmd, bool resetConfigMode) {
int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetConfigMode) {
const static uint8_t HELP_MSG[] = \
"Usage\n\r" \
"\n\r" \
@ -104,7 +104,8 @@ int8_t cmdExecuteCommand(uint8_t *cmd, bool resetConfigMode) {
}
int8_t retCode = 0;
coloredMsg(LOG_YELLOW, "cec, cmd is %s", cmd);
char *cmd = strtok(cmdLine, ' ');
coloredMsg(LOG_YELLOW, "cec, cmdLine is %s, cmd is %s", cmdLine);
if (0 == strcmp(cmd, "quit")) {
messageToSend = GOODBYE_MSG;
retCode = -1;
@ -146,7 +147,6 @@ int8_t cmdExecuteCommand(uint8_t *cmd, bool resetConfigMode) {
}
}
if (messageToSend) {
send(CMD_SOCK, messageToSend, strlen(messageToSend));
}