shell: internal api update: wildcards

Mark global wildcard functions with z_ prefix.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
Jakub Rzeszutko 2020-12-06 11:47:36 +01:00 committed by Carles Cufí
commit 58c7114c17
4 changed files with 14 additions and 14 deletions

View file

@ -630,7 +630,7 @@ static int execute(const struct shell *shell)
} }
if (IS_ENABLED(CONFIG_SHELL_WILDCARD)) { if (IS_ENABLED(CONFIG_SHELL_WILDCARD)) {
shell_wildcard_prepare(shell); z_shell_wildcard_prepare(shell);
} }
/* Parent present means we are in select mode. */ /* 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)) { if (IS_ENABLED(CONFIG_SHELL_WILDCARD) && (cmd_lvl > 0)) {
enum shell_wildcard_status status; enum shell_wildcard_status status;
status = shell_wildcard_process(shell, entry, status = z_shell_wildcard_process(shell, entry,
argvp[0]); argvp[0]);
/* Wildcard character found but there is no matching /* Wildcard character found but there is no matching
* command. * command.
*/ */
@ -747,7 +747,7 @@ static int execute(const struct shell *shell)
} }
if (IS_ENABLED(CONFIG_SHELL_WILDCARD) && wildcard_found) { 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 /* cmd_buffer has been overwritten by function finalize function
* with all expanded commands. Hence shell_make_argv needs to * with all expanded commands. Hence shell_make_argv needs to
* be called again. * be called again.

View file

@ -316,7 +316,7 @@ const struct shell_static_entry *shell_get_last_command(
if (IS_ENABLED(CONFIG_SHELL_WILDCARD)) { if (IS_ENABLED(CONFIG_SHELL_WILDCARD)) {
/* ignore wildcard argument */ /* ignore wildcard argument */
if (shell_wildcard_character_exist(argv[*match_arg])) { if (z_shell_has_wildcard(argv[*match_arg])) {
(*match_arg)++; (*match_arg)++;
continue; continue;
} }

View file

@ -103,7 +103,7 @@ static enum shell_wildcard_status commands_expand(const struct shell *shell,
return ret_val; 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); uint16_t str_len = shell_strlen(str);
@ -116,7 +116,7 @@ bool shell_wildcard_character_exist(const char *str)
return false; 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 can be correctly handled under following conditions:
* - wildcard command does not have a handler * - 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 struct shell_static_entry *cmd,
const char *pattern) const char *pattern)
{ {
@ -166,7 +166,7 @@ enum shell_wildcard_status shell_wildcard_process(const struct shell *shell,
return ret_val; return ret_val;
} }
if (!shell_wildcard_character_exist(pattern)) { if (!z_shell_has_wildcard(pattern)) {
return ret_val; return ret_val;
} }
@ -182,7 +182,7 @@ enum shell_wildcard_status shell_wildcard_process(const struct shell *shell,
return ret_val; 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, memcpy(shell->ctx->cmd_buff,
shell->ctx->temp_buff, shell->ctx->temp_buff,

View file

@ -20,7 +20,7 @@ enum shell_wildcard_status {
* *
* @param[in] shell Pointer to the shell instance. * @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 '*' /* 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 true wildcard character found
* @retval false wildcard character not 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 /* 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] cmd Pointer to command which will be processed.
* @param[in] pattern Pointer to wildcard pattern. * @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 struct shell_static_entry *cmd,
const char *pattern); 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. * @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__ */ #endif /* SHELL_SHELL_WILDCARDS_H__ */