3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

client: readline callback

This commit is contained in:
Tim Kourt 2017-04-20 13:42:20 -07:00 committed by Denis Kenzior
parent 2d567414f1
commit 0ee51c9dab

View File

@ -192,6 +192,29 @@ void display_command(const struct command_family *family, const char *cmd_name)
static void readline_callback(char *prompt) static void readline_callback(char *prompt)
{ {
HIST_ENTRY *previous_prompt;
if (!prompt) {
display_quit();
l_main_quit();
return;
}
if (!strlen(prompt))
goto done;
previous_prompt = current_history();
if (!previous_prompt ||
(previous_prompt &&
strcmp(previous_prompt->line, prompt))) {
add_history(prompt);
}
command_process_prompt(prompt);
done:
l_free(prompt); l_free(prompt);
} }