浏览代码

The help function returns also the type of the parameter.

Miklos Tirpak 18 年之前
父节点
当前提交
d6b0973a39
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 3 1
      cfg/cfg_ctx.c
  2. 1 1
      cfg/cfg_ctx.h

+ 3 - 1
cfg/cfg_ctx.c

@@ -764,7 +764,7 @@ int cfg_get_by_name(cfg_ctx_t *ctx, str *group_name, str *var_name,
 
 /* returns the description of a variable */
 int cfg_help(cfg_ctx_t *ctx, str *group_name, str *var_name,
-			char **ch)
+			char **ch, unsigned int *input_type)
 {
 	cfg_mapping_t	*var;
 
@@ -781,6 +781,8 @@ int cfg_help(cfg_ctx_t *ctx, str *group_name, str *var_name,
 		return -1;
 
 	*ch = var->def->descr;
+	if (input_type)
+		*input_type = CFG_INPUT_TYPE(var);
 	return 0;
 }
 

+ 1 - 1
cfg/cfg_ctx.h

@@ -101,7 +101,7 @@ int cfg_get_by_name(cfg_ctx_t *ctx, str *group_name, str *var_name,
 
 /* returns the description of a variable */
 int cfg_help(cfg_ctx_t *ctx, str *group_name, str *var_name,
-			char **ch);
+			char **ch, unsigned int *input_type);
 
 /* notify the drivers about the new config definition */
 void cfg_notify_drivers(char *group_name, cfg_def_t *def);