aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2012-05-27 08:27:49 +0200
committerErwan Velu <erwanaliasr1@gmail.com>2012-05-27 08:27:49 +0200
commitcd1a23a064f4da78618a9335edd398d12810b848 (patch)
treea2e809cd85ceb01775e3a24c82967d9899e46bbd
parent2b31c32bd0e10b43943b9fdaddb3b4b82192e466 (diff)
downloadsyslinux-cd1a23a064f4da78618a9335edd398d12810b848.tar.gz
syslinux-cd1a23a064f4da78618a9335edd398d12810b848.tar.xz
syslinux-cd1a23a064f4da78618a9335edd398d12810b848.zip
hdt: Adding more debug traces in cli
Adding more debug traces in the cli management to ease debugging & feature adding.
-rw-r--r--com32/hdt/hdt-cli.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 330f93c4..85bd13ff 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -365,14 +365,14 @@ static void parse_command_line(char *line, char **command, char **module,
*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)++;
@@ -380,7 +380,7 @@ static void parse_command_line(char *line, char **command, char **module,
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)
@@ -390,7 +390,7 @@ static void parse_command_line(char *line, char **command, char **module,
*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++;
@@ -585,6 +585,7 @@ static void autocomplete(char *line)
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;
@@ -673,7 +674,7 @@ static void exec_command(char *line, struct s_hardware *hardware)
* 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,
&current_module);
@@ -681,6 +682,7 @@ static void exec_command(char *line, struct s_hardware *hardware)
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,
&current_module);
@@ -691,7 +693,7 @@ static void exec_command(char *line, struct s_hardware *hardware)
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,
&current_module);