@@ -576,6 +576,21 @@ void bt_shell_printf(const char *fmt, ...)
}
}
+void bt_shell_echo(const char *fmt, ...)
+{
+ va_list args;
+ char *str;
+
+ va_start(args, fmt);
+ vasprintf(&str, fmt, args);
+ asprintf(&str, COLOR_HIGHLIGHT "%s" COLOR_OFF, str);
+ va_end(args);
+
+ rl_save_prompt();
+ bt_shell_set_prompt(str);
+ rl_restore_prompt();
+}
+
static void print_string(const char *str, void *user_data)
{
bt_shell_printf("%s\n", str);
@@ -70,6 +70,8 @@ void bt_shell_set_prompt(const char *string);
void bt_shell_printf(const char *fmt,
...) __attribute__((format(printf, 1, 2)));
+void bt_shell_echo(const char *fmt,
+ ...) __attribute__((format(printf, 1, 2)));
void bt_shell_hexdump(const unsigned char *buf, size_t len);
void bt_shell_usage(void);
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> This adds bt_shell_echo which can be used to print messages on the echo area. --- src/shared/shell.c | 15 +++++++++++++++ src/shared/shell.h | 2 ++ 2 files changed, 17 insertions(+)