aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFrancis Laniel <francis.laniel@amarulasolutions.com>2023-12-22 22:02:32 +0100
committerTom Rini <trini@konsulko.com>2023-12-28 12:02:56 -0500
commit9a068377313c1feabb55072d2d1157999cf9d15e (patch)
tree19502dfd7079f0c040ec2cb0a9efeedd3ee60cec /include
parent6bb39f5d16e8531eeca8237454cc528aa54c9e81 (diff)
downloadu-boot-9a068377313c1feabb55072d2d1157999cf9d15e.zip
u-boot-9a068377313c1feabb55072d2d1157999cf9d15e.tar.gz
u-boot-9a068377313c1feabb55072d2d1157999cf9d15e.tar.bz2
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')
-rw-r--r--include/asm-generic/global_data.h4
-rw-r--r--include/cli_hush.h51
2 files changed, 53 insertions, 2 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 0a9b6bd..99bde9e 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -701,6 +701,10 @@ enum gd_flags {
* @GD_FLG_HUSH_OLD_PARSER: Use hush old parser.
*/
GD_FLG_HUSH_OLD_PARSER = 0x1000000,
+ /**
+ * @GD_FLG_HUSH_MODERN_PARSER: Use hush 2021 parser.
+ */
+ GD_FLG_HUSH_MODERN_PARSER = 0x2000000,
};
#endif /* __ASSEMBLY__ */
diff --git a/include/cli_hush.h b/include/cli_hush.h
index 2bd3567..007b8d6 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);