#endif
#if defined(CONFIG_CMD_ENV_CALLBACK)
-static int print_static_binding(const char *var_name, const char *callback_name)
+static int print_static_binding(const char *var_name, const char *callback_name,
+ void *priv)
{
printf("\t%-20s %-20s\n", var_name, callback_name);
puts("Static callback bindings:\n");
printf("\t%-20s %-20s\n", "Variable Name", "Callback Name");
printf("\t%-20s %-20s\n", "-------------", "-------------");
- env_attr_walk(ENV_CALLBACK_LIST_STATIC, print_static_binding);
+ env_attr_walk(ENV_CALLBACK_LIST_STATIC, print_static_binding, NULL);
puts("\n");
/* walk through each variable and print the callback if it has one */
#endif
#if defined(CONFIG_CMD_ENV_FLAGS)
-static int print_static_flags(const char *var_name, const char *flags)
+static int print_static_flags(const char *var_name, const char *flags,
+ void *priv)
{
enum env_flags_vartype type = env_flags_parse_vartype(flags);
enum env_flags_varaccess access = env_flags_parse_varaccess(flags);
"Variable Access");
printf("\t%-20s %-20s %-20s\n", "-------------", "-------------",
"---------------");
- env_attr_walk(ENV_FLAGS_LIST_STATIC, print_static_flags);
+ env_attr_walk(ENV_FLAGS_LIST_STATIC, print_static_flags, NULL);
puts("\n");
/* walk through each variable and print the flags if non-default */
* list = entry[,list]
*/
int env_attr_walk(const char *attr_list,
- int (*callback)(const char *name, const char *attributes))
+ int (*callback)(const char *name, const char *attributes, void *priv),
+ void *priv)
{
const char *entry, *entry_end;
char *name, *attributes;
if (strlen(name) != 0) {
int retval = 0;
- retval = callback(name, attributes);
+ retval = callback(name, attributes, priv);
if (retval) {
free(entry_cpy);
return retval;
/*
* Call for each element in the list that associates variables to callbacks
*/
-static int set_callback(const char *name, const char *value)
+static int set_callback(const char *name, const char *value, void *priv)
{
ENTRY e, *ep;
struct env_clbk_tbl *clbkp;
hwalk_r(&env_htab, clear_callback);
/* configure any static callback bindings */
- env_attr_walk(ENV_CALLBACK_LIST_STATIC, set_callback);
+ env_attr_walk(ENV_CALLBACK_LIST_STATIC, set_callback, NULL);
/* configure any dynamic callback bindings */
- env_attr_walk(value, set_callback);
+ env_attr_walk(value, set_callback, NULL);
return 0;
}
/*
* Call for each element in the list that defines flags for a variable
*/
-static int set_flags(const char *name, const char *value)
+static int set_flags(const char *name, const char *value, void *priv)
{
ENTRY e, *ep;
hwalk_r(&env_htab, clear_flags);
/* configure any static flags */
- env_attr_walk(ENV_FLAGS_LIST_STATIC, set_flags);
+ env_attr_walk(ENV_FLAGS_LIST_STATIC, set_flags, NULL);
/* configure any dynamic flags */
- env_attr_walk(value, set_flags);
+ env_attr_walk(value, set_flags, NULL);
return 0;
}
* attributes = [^,:\s]*
* entry = name[:attributes]
* list = entry[,list]
- * It will call the "callback" function with the "name" and attribute as "value"
+ * It will call the "callback" function with the "name" and "attributes"
* The callback may return a non-0 to abort the list walk.
* This return value will be passed through to the caller.
* 0 is returned on success.
*/
-extern int env_attr_walk(const char *attr_list,
- int (*callback)(const char *name, const char *value));
+int env_attr_walk(const char *attr_list,
+ int (*callback)(const char *name, const char *attributes, void *priv),
+ void *priv);
/*
* env_attr_lookup takes as input an "attr_list" with the same form as above.
* "attr_list" is NULL.
* Returns 0 on success.
*/
-extern int env_attr_lookup(const char *attr_list, const char *name,
- char *attributes);
+int env_attr_lookup(const char *attr_list, const char *name, char *attributes);
#endif /* __ENV_ATTR_H__ */