shell: Support output using a va_list

At present it is not possible to write a printf()-like function in
board code which outputs to the shell. Add shell_vfprintf() to permit
this.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2020-04-30 15:25:04 -06:00 committed by Ioannis Glaropoulos
commit fc0e10d064
3 changed files with 59 additions and 9 deletions

View file

@ -726,6 +726,21 @@ int shell_stop(const struct shell *shell);
void shell_fprintf(const struct shell *shell, enum shell_vt100_color color,
const char *fmt, ...);
/**
* @brief vprintf-like function which sends formatted data stream to the shell.
*
* This function can be used from the command handler or from threads, but not
* from an interrupt context. It is similar to shell_fprintf() but takes a
* va_list instead of variable arguments.
*
* @param[in] shell Pointer to the shell instance.
* @param[in] color Printed text color.
* @param[in] fmt Format string.
* @param[in] args List of parameters to print.
*/
void shell_vfprintf(const struct shell *shell, enum shell_vt100_color color,
const char *fmt, va_list args);
/**
* @brief Print data in hexadecimal format.
*