From 58c7114c177589b252148572db3160a102a2bdaa Mon Sep 17 00:00:00 2001 From: Jakub Rzeszutko Date: Sun, 6 Dec 2020 11:47:36 +0100 Subject: [PATCH] shell: internal api update: wildcards Mark global wildcard functions with z_ prefix. Signed-off-by: Jakub Rzeszutko --- subsys/shell/shell.c | 8 ++++---- subsys/shell/shell_utils.c | 2 +- subsys/shell/shell_wildcard.c | 10 +++++----- subsys/shell/shell_wildcard.h | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/subsys/shell/shell.c b/subsys/shell/shell.c index c02e6f14da2..6b2e3b0bafe 100644 --- a/subsys/shell/shell.c +++ b/subsys/shell/shell.c @@ -630,7 +630,7 @@ static int execute(const struct shell *shell) } if (IS_ENABLED(CONFIG_SHELL_WILDCARD)) { - shell_wildcard_prepare(shell); + z_shell_wildcard_prepare(shell); } /* Parent present means we are in select mode. */ @@ -680,8 +680,8 @@ static int execute(const struct shell *shell) if (IS_ENABLED(CONFIG_SHELL_WILDCARD) && (cmd_lvl > 0)) { enum shell_wildcard_status status; - status = shell_wildcard_process(shell, entry, - argvp[0]); + status = z_shell_wildcard_process(shell, entry, + argvp[0]); /* Wildcard character found but there is no matching * command. */ @@ -747,7 +747,7 @@ static int execute(const struct shell *shell) } if (IS_ENABLED(CONFIG_SHELL_WILDCARD) && wildcard_found) { - shell_wildcard_finalize(shell); + z_shell_wildcard_finalize(shell); /* cmd_buffer has been overwritten by function finalize function * with all expanded commands. Hence shell_make_argv needs to * be called again. diff --git a/subsys/shell/shell_utils.c b/subsys/shell/shell_utils.c index aea755bd30d..a9b560bcbfb 100644 --- a/subsys/shell/shell_utils.c +++ b/subsys/shell/shell_utils.c @@ -316,7 +316,7 @@ const struct shell_static_entry *shell_get_last_command( if (IS_ENABLED(CONFIG_SHELL_WILDCARD)) { /* ignore wildcard argument */ - if (shell_wildcard_character_exist(argv[*match_arg])) { + if (z_shell_has_wildcard(argv[*match_arg])) { (*match_arg)++; continue; } diff --git a/subsys/shell/shell_wildcard.c b/subsys/shell/shell_wildcard.c index 6144b91f75c..8a63b084c62 100644 --- a/subsys/shell/shell_wildcard.c +++ b/subsys/shell/shell_wildcard.c @@ -103,7 +103,7 @@ static enum shell_wildcard_status commands_expand(const struct shell *shell, return ret_val; } -bool shell_wildcard_character_exist(const char *str) +bool z_shell_has_wildcard(const char *str) { uint16_t str_len = shell_strlen(str); @@ -116,7 +116,7 @@ bool shell_wildcard_character_exist(const char *str) return false; } -void shell_wildcard_prepare(const struct shell *shell) +void z_shell_wildcard_prepare(const struct shell *shell) { /* Wildcard can be correctly handled under following conditions: * - wildcard command does not have a handler @@ -156,7 +156,7 @@ void shell_wildcard_prepare(const struct shell *shell) } -enum shell_wildcard_status shell_wildcard_process(const struct shell *shell, +enum shell_wildcard_status z_shell_wildcard_process(const struct shell *shell, const struct shell_static_entry *cmd, const char *pattern) { @@ -166,7 +166,7 @@ enum shell_wildcard_status shell_wildcard_process(const struct shell *shell, return ret_val; } - if (!shell_wildcard_character_exist(pattern)) { + if (!z_shell_has_wildcard(pattern)) { return ret_val; } @@ -182,7 +182,7 @@ enum shell_wildcard_status shell_wildcard_process(const struct shell *shell, return ret_val; } -void shell_wildcard_finalize(const struct shell *shell) +void z_shell_wildcard_finalize(const struct shell *shell) { memcpy(shell->ctx->cmd_buff, shell->ctx->temp_buff, diff --git a/subsys/shell/shell_wildcard.h b/subsys/shell/shell_wildcard.h index 9e7a7faa5d8..bc9c18a2120 100644 --- a/subsys/shell/shell_wildcard.h +++ b/subsys/shell/shell_wildcard.h @@ -20,7 +20,7 @@ enum shell_wildcard_status { * * @param[in] shell Pointer to the shell instance. */ -void shell_wildcard_prepare(const struct shell *shell); +void z_shell_wildcard_prepare(const struct shell *shell); /* Function returns true if string contains wildcard character: '?' or '*' * @@ -29,7 +29,7 @@ void shell_wildcard_prepare(const struct shell *shell); * @retval true wildcard character found * @retval false wildcard character not found */ -bool shell_wildcard_character_exist(const char *str); +bool z_shell_has_wildcard(const char *str); /* Function expands wildcards in the shell temporary buffer * @@ -44,7 +44,7 @@ bool shell_wildcard_character_exist(const char *str); * @param[in] cmd Pointer to command which will be processed. * @param[in] pattern Pointer to wildcard pattern. */ -enum shell_wildcard_status shell_wildcard_process(const struct shell *shell, +enum shell_wildcard_status z_shell_wildcard_process(const struct shell *shell, const struct shell_static_entry *cmd, const char *pattern); @@ -52,7 +52,7 @@ enum shell_wildcard_status shell_wildcard_process(const struct shell *shell, * * @param[in] shell Pointer to the shell instance. */ -void shell_wildcard_finalize(const struct shell *shell); +void z_shell_wildcard_finalize(const struct shell *shell); #endif /* SHELL_SHELL_WILDCARDS_H__ */