Browse Source

The priority=0 is equal to the absence of priority.

git-svn-id: https://klish.googlecode.com/svn/trunk@169 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
7d6a911c3d

+ 9 - 6
clish/clish_config_callback.c

@@ -69,10 +69,12 @@ clish_config_callback(const clish_shell_t * shell,
 			if (clish_command__get_splitter(cmd) == BOOL_FALSE)
 				lub_string_cat(&command, " -i");
 
-			snprintf(tmp, sizeof(tmp) - 1, " -p 0x%x",
-				clish_command__get_priority(cmd));
-			tmp[sizeof(tmp) - 1] = '\0';
-			lub_string_cat(&command, tmp);
+			if (clish_command__get_priority(cmd) != 0) {
+				snprintf(tmp, sizeof(tmp) - 1, " -p 0x%x",
+					clish_command__get_priority(cmd));
+				tmp[sizeof(tmp) - 1] = '\0';
+				lub_string_cat(&command, tmp);
+			}
 
 			if (clish_command__get_seq(cmd) == BOOL_TRUE) {
 				lub_string_cat(&command, " -q");
@@ -115,13 +117,14 @@ clish_config_callback(const clish_shell_t * shell,
 			lub_string_cat(&command, "\"");
 			lub_string_free(pattern);
 
-			if (clish_command__get_seq(cmd) == BOOL_TRUE) {
-	                        /* Send priority too */
+			if (clish_command__get_priority(cmd) != 0) {
 				snprintf(tmp, sizeof(tmp) - 1, " -p 0x%x",
 					clish_command__get_priority(cmd));
 				tmp[sizeof(tmp) - 1] = '\0';
 				lub_string_cat(&command, tmp);
+			}
 
+			if (clish_command__get_seq(cmd) == BOOL_TRUE) {
 				lub_string_cat(&command, " -q");
 				if (clish_command__get_seq_num(cmd,
 					viewid, pargv) != 0) {

+ 1 - 1
clish/command/command.c

@@ -40,7 +40,7 @@ clish_command_init(clish_command_t * this, const char *name, const char *text)
 
 	/* CONFIG params */
 	this->cfg_op = CLISH_CONFIG_NONE;
-	this->priority = 0x7f00; /* medium priority by default */
+	this->priority = 0; /* medium priority by default */
 	this->pattern = NULL;
 	this->file = NULL;
 	this->splitter = BOOL_TRUE;

+ 4 - 1
clish/shell/shell_tinyxml_read.cpp

@@ -530,8 +530,11 @@ process_config(clish_shell_t * shell, TiXmlElement * element, void *parent)
 		clish_command__set_cfg_op(cmd, CLISH_CONFIG_DUMP);
 	else if (operation && !lub_string_nocasecmp(operation, "copy"))
 		clish_command__set_cfg_op(cmd, CLISH_CONFIG_COPY);
-	else
+	else {
 		clish_command__set_cfg_op(cmd, CLISH_CONFIG_SET);
+		/* The priority if no clearly specified */
+		clish_command__set_priority(cmd, 0x7f00);
+	}
 
 	if ((priority != NULL) && (*priority != '\0')) {
 		long val = 0;

+ 1 - 1
konf/query/query.c

@@ -21,7 +21,7 @@ konf_query_t *konf_query_new(void)
 
 	query->op = KONF_QUERY_OP_NONE;
 	query->pattern = NULL;
-	query->priority = 0x7f00;
+	query->priority = 0;
 	query->seq = BOOL_FALSE;
 	query->seq_num = 0;
 	query->pwdc = 0;