From f76ca346168afe6cf68127934765a61bd477380e Mon Sep 17 00:00:00 2001 From: Leo C Date: Sun, 31 Aug 2014 22:37:26 +0200 Subject: $() expansion deleted (only ${}). setenv_ulong(), setenv_hex() --- avr/cli.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'avr/cli.c') diff --git a/avr/cli.c b/avr/cli.c index be5df40..08e7038 100644 --- a/avr/cli.c +++ b/avr/cli.c @@ -56,8 +56,8 @@ static void process_macros(const char *input, char *output) #endif uint_fast8_t state = 0; /* 0 = waiting for '$' */ - /* 1 = waiting for '(' or '{' */ - /* 2 = waiting for ')' or '}' */ + /* 1 = waiting for '{' */ + /* 2 = waiting for '}' */ /* 3 = waiting for ''' */ char *output_start = output; @@ -94,7 +94,7 @@ static void process_macros(const char *input, char *output) } break; case 1: /* Waiting for ( */ - if (c == '(' || c == '{') { + if (c == '{') { state++; varname_start = input; } else { @@ -109,7 +109,7 @@ static void process_macros(const char *input, char *output) } break; case 2: /* Waiting for ) */ - if (c == ')' || c == '}') { + if (c == '}') { char envname[CONFIG_SYS_ENV_NAMELEN+1], *envval; /* Varname # of chars */ uint_fast8_t envcnt = input - varname_start - 1; @@ -153,13 +153,21 @@ static void process_macros(const char *input, char *output) strlen(output_start), output_start); } - /* +/** + * + * * WARNING: * * We must create a temporary copy of the command since the command we get * may be the result from getenv(), which returns a pointer directly to * the environment data, which may change magicly when the command we run * creates or modifies environment variables (like "bootp" does). + * + * + * @param cmd + * @param flag + * @returns + * */ static int cli_run_command(const char *cmd, int flag) { @@ -173,7 +181,7 @@ static int cli_run_command(const char *cmd, int flag) uint_fast8_t inquotes, repeatable = 1; int rc = 0; - debug_parser("[RUN_COMMAND] cmd[%p]=\"%s\"\n", + debug_parser("[RUN_COMMAND] cmd[%p]=\"%s\"\n", cmd, cmd ? cmd : "NULL"); clear_ctrlc(); /* forget any previous Control C */ @@ -290,7 +298,7 @@ static int run_command_repeatable(const char *cmd, int flag) int run_command_list(const char *cmd, int len) { (void) len; - + return cli_run_command_list(cmd); } -- cgit v1.2.3