diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2012-12-11 22:16:33 -0600 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-12-13 11:46:56 -0700 |
commit | fffad71bc489cf224eda6d826a1645423852ee45 (patch) | |
tree | 3fd5278e5515c4ad5043cf4e3ab030c81e9178f6 /common/env_flags.c | |
parent | 30fd4fadb319d7c6d43d949e2d30ffaea46a60cf (diff) |
env: Add a command to display details about env flags
Similar to the env callback command, this will show details about the
options available, the static list, and the currently active variables.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'common/env_flags.c')
-rw-r--r-- | common/env_flags.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/common/env_flags.c b/common/env_flags.c index ed0857cf9e7..09f93d59d63 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -43,6 +43,40 @@ #endif static const char env_flags_vartype_rep[] = "sdxb" ENV_FLAGS_NET_VARTYPE_REPS; +#ifdef CONFIG_CMD_ENV_FLAGS +static const char * const env_flags_vartype_names[] = { + "string", + "decimal", + "hexadecimal", + "boolean", +#ifdef CONFIG_CMD_NET + "IP address", + "MAC address", +#endif +}; + +/* + * Print the whole list of available type flags. + */ +void env_flags_print_vartypes(void) +{ + enum env_flags_vartype curtype = (enum env_flags_vartype)0; + + while (curtype != env_flags_vartype_end) { + printf("\t%c -\t%s\n", env_flags_vartype_rep[curtype], + env_flags_vartype_names[curtype]); + curtype++; + } +} + +/* + * Return the name of the type. + */ +const char *env_flags_get_vartype_name(enum env_flags_vartype type) +{ + return env_flags_vartype_names[type]; +} +#endif /* CONFIG_CMD_ENV_FLAGS */ /* * Parse the flags string from a .flags attribute list into the vartype enum. |