Browse Source

VAR's action can use builtin functions

git-svn-id: https://klish.googlecode.com/svn/trunk@533 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 12 years ago
parent
commit
7e2cf97d5b
1 changed files with 6 additions and 11 deletions
  1. 6 11
      clish/shell/shell_var.c

+ 6 - 11
clish/shell/shell_var.c

@@ -112,9 +112,7 @@ static char *find_context_var(const char *name, clish_context_t *this)
 static char *find_var(const char *name, lub_bintree_t *tree, clish_context_t *context)
 {
 	clish_var_t *var = lub_bintree_find(tree, name);
-	clish_action_t *action;
 	char *value;
-	char *script;
 	bool_t dynamic;
 	char *res = NULL;
 
@@ -136,16 +134,13 @@ static char *find_var(const char *name, lub_bintree_t *tree, clish_context_t *co
 
 	/* Try to execute ACTION */
 	if (!res) {
-		action = clish_var__get_action(var);
-		script = clish_action__get_script(action);
-		if (script) {
-			char *out = NULL;
-			if (clish_shell_exec_action(action, context, &out)) {
-				lub_string_free(out);
-				return NULL;
-			}
-			res = out;
+		char *out = NULL;
+		clish_action_t *action = clish_var__get_action(var);
+		if (clish_shell_exec_action(action, context, &out)) {
+			lub_string_free(out);
+			return NULL;
 		}
+		res = out;
 	}
 
 	/* Save value for static var */