*command = malloc((token_len + 1) * sizeof(char));
strlcpy(*command, pch, token_len);
(*command)[token_len] = '\0';
- dprintf("CLI DEBUG: command = %s\n", *command);
+ dprintf("CLI DEBUG parse: command = %s\n", *command);
args_pos += args_len;
} else if (token_found == 1) {
/* Module */
*module = malloc((token_len + 1) * sizeof(char));
strlcpy(*module, pch, token_len);
(*module)[token_len] = '\0';
- dprintf("CLI DEBUG: module = %s\n", *module);
+ dprintf("CLI DEBUG parse: module = %s\n", *module);
args_pos += args_len;
} else
(*argc)++;
token_found++;
pch = pch_next;
}
- dprintf("CLI DEBUG: argc = %d\n", *argc);
+ dprintf("CLI DEBUG parse: argc = %d\n", *argc);
/* Skip arguments handling if none is supplied */
if (!*argc)
*argv = malloc(*argc * sizeof(char *));
pch = strtok(line + args_pos, CLI_SPACE);
while (pch != NULL) {
- dprintf("CLI DEBUG: argv[%d] = %s\n", argc_iter, pch);
+ dprintf("CLI DEBUG parse: argv[%d] = %s\n", argc_iter, pch);
argv[argc_iter] = malloc(sizeof(pch) * sizeof(char));
strlcpy(argv[argc_iter], pch, sizeof(pch));
argc_iter++;
parse_command_line(line, &command, &module, &argc, argv);
+ dprintf("CLI DEBUG autocomplete: before checking args\n");
/* If the user specified arguments, there is nothing we can complete */
if (argc != 0)
goto out;
* hdt> set mode dmi
*/
if (!strncmp(command, CLI_SHOW, sizeof(CLI_SHOW) - 1)) {
- dprintf("CLI DEBUG: %s command detected\n", CLI_SHOW);
+ dprintf("CLI DEBUG exec: %s command detected\n", CLI_SHOW);
/* Look first for a 'show' callback in the current mode */
find_cli_callback_descr(module, current_mode->show_modules,
¤t_module);
if (current_module != NULL)
current_module->exec(argc, argv, hardware);
else {
+ dprintf("CLI DEBUG exec: Looking for callback\n");
/* Look now for a 'show' callback in the hdt mode */
find_cli_callback_descr(module, hdt_mode.show_modules,
¤t_module);
printf("unknown module: '%s'\n", module);
}
} else if (!strncmp(command, CLI_SET, sizeof(CLI_SET) - 1)) {
- dprintf("CLI DEBUG: %s command detected\n", CLI_SET);
+ dprintf("CLI DEBUG exec : %s command detected\n", CLI_SET);
/* Look now for a 'set' callback in the hdt mode */
find_cli_callback_descr(module, current_mode->set_modules,
¤t_module);