Commit a06be2d07792f6a995faf10df254898a840297fe
Committed by
Tom Rini
1 parent
b0d7beefc1
Exists in
v2017.01-smarct4x
and in
38 other branches
cli: Export cli_simple_process_macros for use outside of cli_simple
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Showing 2 changed files with 10 additions and 2 deletions Side-by-side Diff
common/cli_simple.c
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | return nargs; |
58 | 58 | } |
59 | 59 | |
60 | -static void process_macros(const char *input, char *output) | |
60 | +void cli_simple_process_macros(const char *input, char *output) | |
61 | 61 | { |
62 | 62 | char c, prev; |
63 | 63 | const char *varname_start = NULL; |
... | ... | @@ -236,7 +236,7 @@ |
236 | 236 | debug_parser("token: \"%s\"\n", token); |
237 | 237 | |
238 | 238 | /* find macros in this token and replace them */ |
239 | - process_macros(token, finaltoken); | |
239 | + cli_simple_process_macros(token, finaltoken); | |
240 | 240 | |
241 | 241 | /* Extract arguments */ |
242 | 242 | argc = cli_simple_parse_line(finaltoken, argv); |
include/cli.h
... | ... | @@ -31,6 +31,14 @@ |
31 | 31 | int cli_simple_run_command(const char *cmd, int flag); |
32 | 32 | |
33 | 33 | /** |
34 | + * cli_simple_process_macros() - Expand $() and ${} format env. variables | |
35 | + * | |
36 | + * @param input Input string possible containing $() / ${} vars | |
37 | + * @param output Output string with $() / ${} vars expanded | |
38 | + */ | |
39 | +void cli_simple_process_macros(const char *input, char *output); | |
40 | + | |
41 | +/** | |
34 | 42 | * cli_simple_run_command_list() - Execute a list of command |
35 | 43 | * |
36 | 44 | * The commands should be separated by ; or \n and will be executed |