Sfoglia il codice sorgente

Fix PARAM help. Issue #29.

git-svn-id: https://klish.googlecode.com/svn/trunk@246 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 anni fa
parent
commit
f6dfa1ea97
1 ha cambiato i file con 6 aggiunte e 2 eliminazioni
  1. 6 2
      clish/pargv/pargv.c

+ 6 - 2
clish/pargv/pargv.c

@@ -39,7 +39,7 @@ static clish_parg_t *find_parg(clish_pargv_t * this, const char *name)
 int clish_pargv_insert(clish_pargv_t * this,
 	const clish_param_t * param, const char *value)
 {
-	if (!this || !value || !param)
+	if (!this || !param)
 		return -1;
 
 	clish_parg_t *parg = find_parg(this, clish_param__get_name(param));
@@ -59,7 +59,11 @@ int clish_pargv_insert(clish_pargv_t * this,
 		this->pargv[this->pargc++] = parg;
 		parg->param = param;
 	}
-	parg->value = lub_string_dup(value);
+	parg->value = NULL;
+	if (value)
+		parg->value = lub_string_dup(value);
+
+	return 0;
 }
 
 /*--------------------------------------------------------- */