shell: suppress newlines on boot when promt is an empty string

If the user sets the default_prompt to an empty string no newlines will
be printed during boot.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
This commit is contained in:
Gerhard Jörges 2022-05-18 14:57:30 +02:00 committed by Carles Cufí
commit d99827f0a5
2 changed files with 11 additions and 5 deletions

View file

@ -1413,7 +1413,9 @@ int shell_start(const struct shell *shell)
z_shell_vt100_color_set(shell, SHELL_NORMAL);
}
z_shell_raw_fprintf(shell->fprintf_ctx, "\n\n");
if (z_shell_strlen(shell->default_prompt) > 0) {
z_shell_raw_fprintf(shell->fprintf_ctx, "\n\n");
}
state_set(shell, SHELL_STATE_ACTIVE);
k_mutex_unlock(&shell->ctx->wr_mtx);