diff options
author | Francis Laniel | 2023-12-22 22:02:32 +0100 |
---|---|---|
committer | Tom Rini | 2023-12-28 12:02:56 -0500 |
commit | 9a068377313c1feabb55072d2d1157999cf9d15e (patch) | |
tree | 19502dfd7079f0c040ec2cb0a9efeedd3ee60cec /include/cli_hush.h | |
parent | 6bb39f5d16e8531eeca8237454cc528aa54c9e81 (diff) |
cli: Enables using modern hush parser as command line parser
If one defines HUSH_MODERN_PARSER, it is then possible to use modern parser with:
=> cli get
old
=> cli set modern
=> cli get
modern
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Diffstat (limited to 'include/cli_hush.h')
-rw-r--r-- | include/cli_hush.h | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/include/cli_hush.h b/include/cli_hush.h index 2bd35670c73..007b8d6372f 100644 --- a/include/cli_hush.h +++ b/include/cli_hush.h @@ -12,11 +12,58 @@ #define FLAG_REPARSING (1 << 2) /* >=2nd pass */ #define FLAG_CONT_ON_NEWLINE (1 << 3) /* continue when we see \n */ +#if CONFIG_IS_ENABLED(HUSH_OLD_PARSER) extern int u_boot_hush_start(void); -extern int parse_string_outer(const char *, int); +extern int parse_string_outer(const char *str, int flag); extern int parse_file_outer(void); - int set_local_var(const char *s, int flg_export); +#else +static inline int u_boot_hush_start(void) +{ + return 0; +} + +static inline int parse_string_outer(const char *str, int flag) +{ + return 1; +} + +static inline int parse_file_outer(void) +{ + return 0; +} + +static inline int set_local_var(const char *s, int flg_export) +{ + return 0; +} +#endif +#if CONFIG_IS_ENABLED(HUSH_MODERN_PARSER) +extern int u_boot_hush_start_modern(void); +extern int parse_string_outer_modern(const char *str, int flag); +extern void parse_and_run_file(void); +int set_local_var_modern(char *s, int flg_export); +#else +static inline int u_boot_hush_start_modern(void) +{ + return 0; +} + +static inline int parse_string_outer_modern(const char *str, int flag) +{ + return 1; +} + +static inline void parse_and_run_file(void) +{ +} + +static inline int set_local_var_modern(char *s, int flg_export) +{ + return 0; +} +#endif + void unset_local_var(const char *name); char *get_local_var(const char *s); |