summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli_new.c9
-rw-r--r--src/cli_val.h8
-rw-r--r--src/cli_val_engine.c22
3 files changed, 37 insertions, 2 deletions
diff --git a/src/cli_new.c b/src/cli_new.c
index 97af812..a998b91 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -680,6 +680,8 @@ boolean val_cmp(valstruct *left, valstruct *right, vtw_cond_e cond)
else
rstop = 1;
+ DPRINT("val_cmp: type=%d count=(%d,%d) val=(%s,%s)\n",
+ val_type, lstop, rstop, left->val, right->val);
for(lcur = 0; lcur < lstop; ++lcur) {
if (!lcur && !left->cnt)
lval = left->val;
@@ -774,9 +776,13 @@ static boolean check_comp(vtw_node *cur)
memset(&right, 0 , sizeof(right));
ret = FALSE; /* in case of status */
status = eval_va(&left, cur->vtw_node_left);
+ DPRINT("check_comp left status=%d type=%d cnt=%d val=[%s]\n",
+ status, left.val_type, left.cnt, left.val);
if (status)
goto free_and_return;
status = eval_va(&right, cur->vtw_node_right);
+ DPRINT("check_comp right status=%d type=%d cnt=%d val=[%s]\n",
+ status, right.val_type, right.cnt, right.val);
if (status)
goto free_and_return;
if(left.val_type != right.val_type) {
@@ -1092,6 +1098,7 @@ static int eval_va(valstruct *res, vtw_node *node)
clind_path_ref n_cmd_path=NULL;
pathp = node->vtw_node_string;
+ DPRINT("eval_va var[%s]\n", pathp);
assert(pathp[0]=='$' && pathp[1]=='(');
pathp += 2;
@@ -1117,7 +1124,6 @@ static int eval_va(valstruct *res, vtw_node *node)
&n_tmpl_path,
&n_cmd_path,
is_in_delete_action())==0) {
-
clind_val cv;
memset(&cv,0,sizeof(cv));
@@ -1150,6 +1156,7 @@ static int eval_va(valstruct *res, vtw_node *node)
}
case VAL_OP:
+ DPRINT("eval_va val[%s]\n", res->val);
*res = node->vtw_node_val;
res->free_me = FALSE;
return 0;
diff --git a/src/cli_val.h b/src/cli_val.h
index fec8054..7383263 100644
--- a/src/cli_val.h
+++ b/src/cli_val.h
@@ -215,4 +215,12 @@ extern FILE *out_stream;
extern int initialize_output();
+/*** debug ***/
+#undef CLI_DEBUG
+#ifdef CLI_DEBUG
+#define DPRINT(...) printf(__VA_ARGS__)
+#else
+#define DPRINT(...)
+#endif
+
#endif
diff --git a/src/cli_val_engine.c b/src/cli_val_engine.c
index fddad4c..50a02df 100644
--- a/src/cli_val_engine.c
+++ b/src/cli_val_engine.c
@@ -125,6 +125,10 @@ static char** clind_get_current_value(clind_path_ref cfg_path,
int value_ref = 0;
*ret_size=0;
+ DPRINT("get_current_value cfg[%s] tmpl[%s] chkexist=%d\n",
+ clind_path_get_path_string(cfg_path),
+ clind_path_get_path_string(tmpl_path),
+ check_existence);
if(val_type) *val_type=TEXT_TYPE;
if(cfg_path && (clind_path_get_size(cfg_path)>0)) {
@@ -213,7 +217,14 @@ static char** clind_get_current_value(clind_path_ref cfg_path,
ret=(char**)realloc(ret,sizeof(char*)*1);
ret[0]=clind_unescape(cfg_end);
*ret_size=1;
- }
+ } else {
+ /* we are checking existence, and it doesn't exist */
+ /* return empty string */
+ ret = (char**) realloc(ret, (sizeof(char *) * 1));
+ ret[0] = malloc(1);
+ ret[0][0] = 0;
+ *ret_size = 1;
+ }
}
if(ret) {
@@ -357,6 +368,9 @@ static clind_path_ref* clind_config_engine_apply_command(clind_path_ref cfg_path
int *result_len) {
clind_path_ref* ret=NULL;
+ DPRINT("eng_apply_cmd cfg=[%s] tmpl=[%s] type=%d\n",
+ clind_path_get_path_string(cfg_path),
+ clind_path_get_path_string(tmpl_path), cmd->type);
if(cfg_path && tmpl_path && result_len && cmd) {
/*
@@ -595,6 +609,12 @@ int clind_config_engine_apply_command_path(clind_path_ref cfg_path_orig,
clind_path_get_path_string(cmd_path),
root_tmpl_path);
*/
+ DPRINT("eng_apply_cmd_path cfg=[%s] tmpl=[%s] cmd=[%s] "
+ "rcfg=[%s] rtmpl=[%s]\n",
+ clind_path_get_path_string(cfg_path_orig),
+ clind_path_get_path_string(tmpl_path_orig),
+ clind_path_get_path_string(cmd_path),
+ root_cfg_path, root_tmpl_path);
if(cfg_path_orig && tmpl_path_orig && cmd_path && res) {