[PATCH 1/5] hush: Print syntax error line with DEBUG_SHELL

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Mar 1 00:51:41 CET 2021


Am 1. März 2021 00:47:14 MEZ schrieb Sean Anderson <seanga2 at gmail.com>:
>This prints the filename (rather useless) and line (very useful)
>whenever a
>syntax error occurs if DEBUG_SHELL is enabled.

Please, use log_error() instead.

Best regards

Heinrich

>
>Signed-off-by: Sean Anderson <seanga2 at gmail.com>
>---
>
> common/cli_hush.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
>diff --git a/common/cli_hush.c b/common/cli_hush.c
>index 1b9bef64b6..83329763c6 100644
>--- a/common/cli_hush.c
>+++ b/common/cli_hush.c
>@@ -372,15 +372,17 @@ static inline void debug_printf(const char
>*format, ...) { }
> #endif
> #define final_printf debug_printf
> 
>-#ifdef __U_BOOT__
>+#ifdef DEBUG_SHELL
>+static void __syntax(char *file, int line)
>+{
>+	error_msg("syntax error %s:%d\n", file, line);
>+}
>+
>+#define syntax_err() __syntax(__FILE__, __LINE__)
>+#else
> static void syntax_err(void) {
> 	 printf("syntax error\n");
> }
>-#else
>-static void __syntax(char *file, int line) {
>-	error_msg("syntax error %s:%d", file, line);
>-}
>-#define syntax() __syntax(__FILE__, __LINE__)
> #endif
> 
> #ifdef __U_BOOT__



More information about the U-Boot mailing list